Hi Javier

Thanks a bunch for your help.


>man is your friend. man 5 crontab says:
>
>"...cron(8) will look at MAILTO if it has any reason to send mail as a 
>result
>of running commands in ``this'' crontab. If MAILTO is defined (and 
>non-empty),
>mail is sent to the user so named. If MAILTO is defined but empty 
>(MAILTO=""),
>no mail will be sent. Otherwise mail is sent to the owner of the crontab."
>
>So, all you need to do is to set the MAILTO variable in your crontab.

Actually, i noticed that too when went throught the man pages. I guess i 
didn't ask my question very clearly. I was wondering if i could have  a mail 
sent to another email address inaddition to the one specified in the MAILTO 
field. For example, have the output of the virus scan sent to an email 
different than root. If this is not possible, is it possible to set up a 
forwarding email so that all email that gets sent to root also gets sent to 
some trusted third party email address?


>Hmm... I think that the first three lines in your crontab should be just 
>one
>(or did mutt mangle the single long line?).

This is what the whole /etc/crontab file looks like:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

0-59/5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg

00 2 * * sun sweep /www/servers/skylight.ubc.ca/media/ 
/www/servers/skylight.ubc.ca/profsTalk > 
/www/logs/skylight.ubc.ca/virusLog/log

00 1 * * sun /root/scripts/backup.sh





This is what the  backup.sh file looks like now and it work great :)

Thanks a bunch for the tips and pointers:

#
# Back up shell script
#

#!/bin/bash

currDateCommand="date +%B%d,%Y"
currDate=`$currDateCommand`
echo $currDate

mkdir /data/backup/$currDate

# Backup the web server files
#tar cfv www.tar /data/www
#gzip www.tar
#mv www.tar.gz /data/backup/$currDate/
cd /data/www
tar cvzf /data/backup/$currDate/www.tar.gz .

# Backup the database
mysqldump --all-databases -udlee -psomepassword > 
/data/backup/$currDate/all_databases.sql


> >
> > # Backup the database
> > mysqldump --all-databases -udlee -psomepassword > 
>/data/backups/$currDate/
>
>Missing a filename for the mysql backup?

Thanks

>
> > Also, I think i have to be root to run the above commands, should this 
>be a
> > problem, or does the crontab run the backup.sh script as root?
>
>Not a problem if you place the script in root's crontab.

That's great :)


Just a couple more questions:

The documentation 
(http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/cron-task.html) 
says the following:
"To start the cron service, use the command /sbin/service crond start. To 
stop the service, use the command /sbin/service crond stop. It is 
recommended that you start the service at boot time. Refer to Chapter 8 for 
details on starting the cron service automatically at boot time."
But in chapter 8 i couldn't really understand what they were talking about. 
They said something along the lines of run levels. So, to get the cron tab 
to run at book i should be interested in the level 6 run level because that 
relates to stuff when the box gets rebooted. Am i supppose to add a file 
then to the /etc/rc.d/rc6.d/ diretory or am i suppose to edit a file there?

I thought that to automate a process at start up you add an entry to the 
/etc/rc.d/rc.local file. So, would it be sufficient to just add the 
following to my /etc/rc.d/rc.local file:
/sbin/service crond start

Also, do i have to shut down the crontab on reboot aswell? If so, where do i 
do this?

Oh, and totally unrelated question, can someone tell me what i have to do to 
get my floppy, zipdisk and rom drives mounted at boot time? Right now if i 
get the following in the mnt/ dir

ls /mnt/
cdrom  floppy  test

So does this mean that my rom an floppy are already mounted? Oh and what's 
test?


Thansk a bunch

Desmond

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to