![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Linux Support Linux - Operating Systems and Applications Support |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Semi-Retired Manager, Microsoft Support
|
Scripts in FC3
Does anyone have any good sources for tutorials?
What I need to do is write a script that will back up a directory and it's data (and all subs) to a .tar file. Then burn that .tar to a CD, verify the burn, and then wait for the user to ok deleting the .tar. Once the script works, I need to be able to schedule it to run every week (CRON?) *I'm assuming that I can call an installed app to handle the burn*
__________________
![]() “The man who smiles when things go wrong has thought of someone to blame it on. ” - Robert Bloch Last edited by Chevy : 04-25-2005 at 07:40 PM. |
|
|
|
|
|
#2 (permalink) |
|
Semi-Retired Manager, Microsoft Support
|
Ok ... this will show how new I am at all this ...
Will this command: tar -cz /hold/sharebak.tar.gz /share create an archive of the directory /share and all it contains, named sharebak.tar.gz, in the directory /hold? Or am I way off?
__________________
![]() “The man who smiles when things go wrong has thought of someone to blame it on. ” - Robert Bloch |
|
|
|
|
|
#3 (permalink) |
|
Asst. Manager, Alternative Computing Forums
|
Link to page of backup applications. CDTARchive looks interesting, if you don't mind a graphical application. http://www.linux.org/apps/all/Admini...on/Backup.html
Another possibly interesting link for the Fedora user. http://www.linux.org/docs/ldp/howto/...WTO/index.html and more How-to's from Linuxonline http://www.linux.org/docs/ldp/howto/...EX/howtos.html
__________________
It's better to know me and not need me than to need me and not know me. B. While users are never under any obligation, if you feel the urge please feel free to visit our donation page. Every little bit helps. And we thank you for your support. Microsoft free Registered Linux user 397458 Last edited by batty_professor : 04-25-2005 at 08:30 PM. Reason: more |
|
|
|
|
|
#4 (permalink) |
|
Semi-Retired Manager, Microsoft Support
|
BP -- thanks, I'll check it out
Plus, I see where I made my error ... I had to specify the output was to create a file that was gzipped (I kept the v option to see the verbose output) tar -cvzf then specify the destination /hold/sharebak.tar.gz then specify the source/target /share .... GUI is nice, but I think the cli is the way to learn ... plus, it really puts people in a state of awe when all they see is archaic looking commands ... ![]()
__________________
![]() “The man who smiles when things go wrong has thought of someone to blame it on. ” - Robert Bloch |
|
|
|
|
|
#5 (permalink) |
|
Asst. Manager, Alternative Computing Forums
|
You make a good point with the "awe" thing. Check the links I added to my prev. post too.
__________________
It's better to know me and not need me than to need me and not know me. B. While users are never under any obligation, if you feel the urge please feel free to visit our donation page. Every little bit helps. And we thank you for your support. Microsoft free Registered Linux user 397458 |
|
|
|
|
|
#6 (permalink) | |
|
Semi-Retired Manager, Microsoft Support
|
Quote:
__________________
![]() “The man who smiles when things go wrong has thought of someone to blame it on. ” - Robert Bloch |
|
|
|
|
|
|
#7 (permalink) |
|
Senior Member
|
!!!!!!!!!!!!!!!!!!!!!!!!!WARNING COMPLETELY UNTESTED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#!/bin/bash SPEED = "24" BACKUPDIR = "/home/chevsjunk/" tar -cpvf backup-`date +%F`.tar $BACKUPDIR && \ dd if=../$BACKUPDIR/backup-`date +%F`.tar of=backup-`date +%F`.iso && \ cdrecord -v speed=$SPEED dev=0,0,0 -data ../$BACKUPDIR/backup-`date +%F`.iso && \ rm -rf ../$BACKUPDIR/backup-`date +%F`.tar && ../$BACKUPDIR/backup-`date +%F`.iso think that should do ya =) save it to somewhere you'll remember.. not the backup directory though! and then add it to cron via the crontab -e command and follow what the other cron entries look like
__________________
|
|
|
|
|
|
#8 (permalink) |
|
Semi-Retired Manager, Microsoft Support
|
You are THE man!
I'll let you know how it works. To clarify - BACKUPDIR is the destination .. and the source? So, if I wanted it to tar a directory (and subs), placing the tar file in /hold #!/bin/bash SPEED = "24" BACKUPDIR = "/home/chevsjunk/" tar -cpvf /hold/backup-`date +%F`.tar $BACKUPDIR && \ dd if=../hold/backup-`date +%F`.tar of=backup-`date +%F`.iso && \ cdrecord -v speed=$SPEED dev=0,0,0 -data ../hold/backup-`date +%F`.iso && \ rm -rf ../hold/backup-`date +%F`.tar && ../hold/backup-`date +%F`.iso ?
__________________
![]() “The man who smiles when things go wrong has thought of someone to blame it on. ” - Robert Bloch |
|
|
|
|
|
#9 (permalink) |
|
Senior Member
|
BACKUPDIR is the directory that you are backing up, the destination .. If you were to just run the script it would assume that the destination is your current working directory. If you want to specify something else you could do this:
By the way the p flag to tar preserves permissions so that when you untar they aren't all screwed up which is pretty common (I've done it a number of times) #!/bin/bash #specify your CDR speed SPEED = "24" #specify the directory and any subdirectories under it that you want to backup BACKUPDIR = "/home/chevsjunk/" #speficy the destination directory for the tar'd files DEST ="/hold" tar -cpvf $DEST\backup-`date +%F`.tar $BACKUPDIR && \ dd if=../$DEST/backup-`date +%F`.tar of=$DEST/backup-`date +%F`.iso && \ cdrecord -v speed=$SPEED dev=0,0,0 -data ../$DEST/backup-`date +%F`.iso && \ rm -rf ../$DEST/backup-`date +%F`.tar && ../$DEST/backup-`date +%F`.iso
__________________
Last edited by gotissues68 : 05-04-2005 at 01:35 PM. |
|
|
|
|
|
#10 (permalink) |
|
Semi-Retired Manager, Microsoft Support
|
Well, I'm getting ": bad interpreter: No such file or directory" when I run this script.
I'm wondering - it seems like there is no path variable like in SuSE or Windows. Many commands need to have the full path specified (shutdown for instance), regardless of me being logged in a root or a general user. Maybe I did something wrong on install?
__________________
![]() “The man who smiles when things go wrong has thought of someone to blame it on. ” - Robert Bloch |
|
|
|
![]() |
| Thread Tools | |
|
|