Rosemary McGillicuddy wrote:
Rosemary,
 /etc/cron.daily is a directory where you put the scripts that you
want cron to run every day. As long as the script is marked
executable, cron will try to run it once a day. The time it runs is
controlled by /etc/crontab. There are also directories for hourly,
weekly, and monthly cron jobs.

The advantage of having the directory, with individual jobs, instead
of one big file, is that a package that needs a cron job run can just
add a file to the directory when it is installed, update it if
necessary when the package is updated, and remove it if the package
is removed.

The other advantage is that if I add my own system cron job, I can
turn it off by changing the file permissions so that it is no longer executable, and the file is still there waiting for me when I want to turn it back on. This can be handy for things like a daily cron job
that you want to turn off while you are on vacation, and then turn
back on...


Mikkel
--

  Do not meddle in the affairs of dragons,
for you are crunchy and taste good with Ketchup!



Mikkel

I pretty much understood that.  I realised that the idea was to put the
script in there to run whenever what I wanted it to.  What I am having
the problem with - is how to get the script in cron.daily ...

thanks
Rosemary


Oh - now I understand. You do this in the same way you create a new text file anyware on the system. The way I do it is:

Log in as my normal user.
Create a new text file in a text editor. Usualy mcedit, but any text editor will work.
make the file executable, and make sure it runs. (find typing errors and stuff...)
change to root
copy the file to /etc/cron.daily
back to normal user.


For example, I maight do this:

mcedit virus-scan.sh
[enter script]
chmod +x virus-scan.sh
./virus-scan.sh
su
chown root.root virus-scan.sh
mv virus-scan.sh /etc/cron.daily
exit

Now, not all scripts will run properly as a normal user, but you can usualy do most of the testing that way. The only things you need to be root for are changing the owner of the file, and moving the file to /etc/cron.daily. The reasion you have to be root to put the file in /etc/cron.daily is that a normal user does not have write permission for the directory. This is a good thing, because the scripts in that directory are run as root.

Mikkel
--

  Do not meddle in the affairs of dragons,
for you are crunchy and taste good with Ketchup!

____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to