LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-30-2004, 07:38 AM   #1
kenji1903
Member
 
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301

Rep: Reputation: 30
cron backups


Wonder this is the right place to ask about cron jobs

Just a simply one, won't take a few minutes

I thought of 2 ways of backing up my /home directory:
1. straight backup (record) into a CD-R
2. tar.gz it and then copy it into the CD-R (is it possible?)

So the 2nd option would have 2 lines in the crontab, say:
00 23 * * * tar -cvzf /tmp/xxx.tar.gz /home
30 23 * * * cp /tmp/xxx.tar.gz /mnt/cdrom


Anyone reckon this would work? would it be faster than the 1st option?

ChEErs,
~WiLL~
 
Old 05-30-2004, 08:26 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
If I recall correctly, you would need to make an iso image before burning to cdrom.
With that in mind, you could look into mondoarchive which can do that automatically as part of the cron job.

I used the ( -F ) switch so it doesn't pop an error about no floppy being made.

Here are a couple of examples from man mondoarchive...

EXAMPLES
Backup to a directory; note that /mnt/foo's contents will be backed up except for its ISO's unless you exclude it, as follows:-
mondoarchive -Oi -d /mnt/foo -E /mnt/foo

Backup to tape, using lzo compression:
mondoarchive -Ot -d /dev/st0 -L -s 4000m

Verify existing tape backup which was made with lzo compression:-
mondoarchive -Vt -d /dev/st0 -L

Backup to 700MB CD-R disks using a 16x CD burner:
mondoarchive -Oc 16 -s 700m

Verify existing CD-R or CD-RW backup (works for either):-
mondoarchive -Vc 16

Backup to an NFS mount:
mondoarchive -On 192.168.1.2:/home/nfs -d /Monday -E /mnt/nfs

Verify existing NFS backup:-
mondoarchive -Vn 192.168.1.2:/home/nfs -d /Monday

Backup to 650MB CD-RW disks using a 4x CD ReWriter:
mondoarchive -Ow 4

Backup just youre /home and /etc directory to 650MB CD-RW disks using a 4x CD ReWriter:
mondoarchive -Ow 4 -I "/home /etc''

Backup to ISO's non-interactively, e.g. as a job running in /etc/cron.daily:
mondoarchive -Oig9 -d /bkp/`date +%A` -E /bkp

Last edited by homey; 05-30-2004 at 08:42 AM.
 
Old 05-30-2004, 08:57 AM   #3
kenji1903
Member
 
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301

Original Poster
Rep: Reputation: 30
Wow... very detailed explanation, homey~

I'll get right to it, hehe

Thanks~!
 
Old 05-30-2004, 09:00 AM   #4
kenji1903
Member
 
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301

Original Poster
Rep: Reputation: 30
Mondo... sounds kinda familiar... i need to download it right?
 
Old 05-30-2004, 09:05 AM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Yeah I had to download it.
 
Old 05-30-2004, 11:04 PM   #6
kenji1903
Member
 
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301

Original Poster
Rep: Reputation: 30
I am still looking at mondo

But something else is bothering me at the moment; crontab, permissions and ownerships...
Since its not a good idea to run stuff as root, so I created /etc/cron.allow and added a user there; "will" in my case.
So to edit crontab i typed: crontab -uwill -e

I have a backup executable stored in /mnt/backup where /mnt is owned by root and /mnt/backup is will.

cron failed to run initially because last night i created and ran everything as root, now i changed /mnt/backup and the script's ownership to will, it works fine...
Just wondering if its better to change ownership or change the rwx permission of the file and directory where the script is stored?

I also can't reboot my PC if i ran cron with will, i got this message in /var/spool/mail/will:
reboot: must be superuser
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
No More Cron Mail, Cron Error? Xhost Linux - General 3 07-26-2004 04:28 PM
cron script backups cbeach512 Linux - Newbie 1 01-06-2004 02:00 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 09:57 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration