LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-18-2006, 10:43 PM   #1
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
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?
 
Old 10-18-2006, 10:57 PM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 61
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
 
Old 10-18-2006, 11:06 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
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.
 
Old 10-19-2006, 10:37 AM   #4
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Original Poster
Rep: Reputation: 45
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

Last edited by Micro420; 10-19-2006 at 11:00 AM.
 
Old 10-19-2006, 02:07 PM   #5
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
X apps fail when run from cron jobs ericcarlson Linux - Software 4 05-31-2009 05:26 PM
logging daily cron jobs in separate files csmwlee Linux - Newbie 5 10-10-2005 10:30 AM
Can't run cron jobs as user, only root Kropotkin Linux - Newbie 5 11-10-2004 09:30 AM
Cron jobs, will they run when not logged in? nextekcarl Linux - General 18 03-30-2004 10:28 AM
Daily Cron jobs with a PHP file Gargomel7 Programming 7 09-13-2003 07:21 PM


All times are GMT -5. The time now is 12:40 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration