LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to run jobs in /etc/cron.daily? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-jobs-in-etc-cron-daily-493705/)

Micro420 10-18-2006 10:43 PM

How to run jobs in /etc/cron.daily?
 
I found this neat backup script that can do differential backups using tar. The website told me to put the script in /etc/cron.daily. I put it in there but the job is not running daily. When I run the job manually, then it runs fine. Any ideas?

IBall 10-18-2006 10:57 PM

Is cron running?

Is the script executable?

What is the line in /etc/crontab that refers to cron.daily. On my system, it looks like:
Code:

25 6    * * *  root    test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
Obviously, my computer is on at 6:25am - if yours isn't then change the time to something else.

I hope this helps
--Ian

Bruce Hill 10-18-2006 11:06 PM

You edit cron jobs by issuing "crontab -e" as the intended user.

If you want to run a script, read "man crontab" to find out how.

These jobs backup 3 of our comps nightly whilst we sleep:
Code:

#This is to backup silas/mingdao every morning at 1:00 a.m.
00 1 * * * rsync -va --exclude=WinXP.img --exclude=scratch.img -e "ssh -o BatchMode=yes -o user=root -i /root/.ssh/id
entity.silas"    wired_silas:~mingdao /backup2/silas/

#This is to backup peter/anna every morning at 1:30 a.m.
30 1 * * * rsync -vaz -e "ssh -o BatchMode=yes -o user=root -i /root/.ssh/identity.peter"    peter:~anna  /backup2/pe
ter/

#This is to backup titus/mingdao every morning at 3:30 a.m.
30 3 * * * rsync -vaz -e "ssh -o BatchMode=yes -o user=root -i /root/.ssh/identity.titus"    titus:~mingdao  /backup2
/titus/

That gets three computers backed up while I'm sleeping every night.

Micro420 10-19-2006 10:37 AM

Quote:

Originally Posted by IBall
Is cron running?

Yes. When I do ps -aux | grep cron, I see the cron running. I even restarted the cron service.

Quote:

Originally Posted by IBall
Is the script executable?

Yes. It has 755 permissions (RWXR-XR-X)

Quote:

Originally Posted by IBall
What is the line in /etc/crontab that refers to cron.daily. On my system, it looks like:
Code:

25 6    * * *  root    test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily

That is the exact same text and time in my /etc/crontab

Quote:

Originally Posted by Bruce Hill
You edit cron jobs by issuing "crontab -e" as the intended user.

If you want to run a script, read "man crontab" to find out how.

I read crontab, and it keeps mentioning the user. I would like to run this script as root. Is this possible in crontab?

Thanks for the rsync commands (may try this another time), but the script I use calls for tar and creates differential backups onto an external hard drive. The reason is that I need be able to upload the differential backups to a remote site. It's smaller and quicker than a complete backup

Bruce Hill 10-19-2006 02:07 PM

The user who is logged in is the user whose jobs "crontab -e" edits.
Code:

mingdao@silas:~$ man crontab
DESCRIPTION
      crontab  manipulates the crontab for a particular user

If your "differential backup" is the same as "incremental backup" -
that's way rsync does:
Code:

mingdao@silas:~$ man rsync
DESCRIPTION
      rsync  is  a  program  that  behaves  in  much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to
      greatly speed up file transfers when the destination file is being updated.

      The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using  an
      efficient checksum-search algorithm described in the technical report that accompanies this package

If you're doing an incremental backup, you could do it directly to
the remote site with rsync; or to the ext. drive and the remote site.


All times are GMT -5. The time now is 01:05 AM.