Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gettin no Unix error msg 1

Status
Not open for further replies.

RexJacobus

Programmer
Dec 10, 2001
47
NZ
Hello,

I need to write a simple cron that deletes things older than thirty days.

I have created a file del_list.csh and placed it in the cron folder. The entire file is this:
_______
#!/bin/csh
#
#set echo

find <path>/toplist –name “*.html” –mtime +30 –exec rm –rf {} \;
-------

If I type the single line of code into the command line it works. If I try to run the file by typing "tcsh del_list.csh" nothing happens. Nothing is deleted and there is no error msg.

del_list.csh is owned by user 'ma' and the permissions are set at 777. The files I'm trying to delete are also owned by user 'ma'.

Why does nothing happen and I get no error msg?

thanks,

RexJ
 

Have you checked your mail? cron will send output messages to mail.
But better, create a log file:
Code:
# crontab entry:
00 09 * * * /path/to/script/del_list.csh >/path/to/log/del_list.log 2>&1
[3eyes]
Also, csh is OBSOLETE, at a minimum use sh or ksh or bash.


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top