[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using cron



* Hal Vaughan:
> On Thursday 21 April 2005 04:08 pm, brandon wrote:
>
>> Hi, suppose i want to run a backup script daily that zips up some of my
>> configuration files and place it in my home directory.
>>
>> I created a file named backup, and put a single line command in it
>>
>> tar -zcvf /home/brandon/backup.tar.gz2 /etc/fstab /etc/X11/XF86Config-4
>> (and other files)
>>
>> i did a chmod +rwx on it, and placed it in the /etc/cron.daily/ directory.
>>
>> i tested the script using ./backup and it works as intended
>>
>> However some days have passed and it hasnt run once yet. what else
>> should i do to make it work?

Maybe you are missing the #!/bin/sh line at the beginning? I am not sure
whether it is needed in that situation. It certainly wouldn't hurt.

However, if you only backup world-readable files I suggest you to run 
'crontab -e' as normal user and add

@daily  ~/bin/myscript.sh
# EOF

to the file (whether it's empty or not). Make sure you have an empty or
commented line at the end of the file.

That way you make sure you don't have root-owned files on your home
directory and you don't use root privileges without a reason.

> You don't put the script itself in the directory.  Actually, you don't touch 
> those directories.  (How would cron know when to run it???) 

Well, because it's in the cron.daily folder, the script should run
daily. That's generally fine.

J.
-- 
Whenever I hear the word 'art' I reach for my visa card.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>



Reply to: