Answer» Hello,
I need to write a simple cron job 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 /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 What happens if you "./del_list.csh" instead of "tcsh del_list.csh"?./del_list.csh gives the same thing. No results and no error msg.
RexJ
(and I have always been WARY of disembodied heads, but thanks for the warning)Do you have a BLANK line at the end of your script? I only ask because in testing, this script fails for me unless there's a terminating NEWLINE. I suspect it's something to do with the way the lines are parsed by csh.You, sir, are the MAN. A single blank line at the end fixed everything and even added body and shine to my hair.
thanks,
RexJExcellent. I hope your shoes are vibrating with delight also.
|