[ale] cron question
Marvin, International Martian of Mystery
marvin.higginbottom at gmail.com
Tue Jun 13 11:19:56 EDT 2006
Jason Day wrote:
> On Sat, Jun 10, 2006 at 09:17:27AM -0400, Marvin, International Martian of Mystery wrote:
>
>> As you can see it's supposed to run every morning at 1 AM. This is the
>> script it's supposed to run:
>>
>>
>>
>> #! /bin/sh
>>
>> cd ./9
>>
>> rm -Rf *
>>
>> cd ../12
>>
>> rm -Rf *
>>
>
> Ack!! DO NOT DO THIS!!!
>
> Note that if the first command fails (cd ./9), the next command will
> still be executed, without having changed directories. This means that
> if the scripts starts in the root directory, and the "cd ./9" command
> fails, then the "rm -Rf *" will happen in the root directory and delete
> the entire contents of your drive. Even if the script does not start in
> /, it will still recursively delete everything in the current directory
> if the cd command failed, which is probably not what you want.
>
> Much better is to use something like:
>
> /bin/rm -Rf /full/path/to/9/*
> ...
>
> And as Geoffrey mentioned, you should use the full path to all commands,
> in addition to the directories.
>
Thanx, Jason. I'll remember that in the future. :-)
Just to let everyone know, the script is executing perfectly now.
Thanx again to everyone who helped out!
More information about the Ale
mailing list