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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-18-2006, 11:43 PM
|
#1
|
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:
|
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?
|
|
|
10-18-2006, 11:57 PM
|
#2
|
Senior Member
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
|
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
|
|
|
10-19-2006, 12:06 AM
|
#3
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
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.
|
|
|
10-19-2006, 11:37 AM
|
#4
|
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:
|
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 12:00 PM.
|
|
|
10-19-2006, 03:07 PM
|
#5
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
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 03:27 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|