|
|
#1 (permalink) |
|
Bronze Member
![]() Join Date: Jan 2005
Posts: 93
|
Hi All,
This is a question for the more technical script writers out there. ------ I wish to create a script that will simple Back up (tar) a certain directory, and then FTP the tar file to a different box. ------ As simple as that. Maybe as a little bit to make it smarter would be for it to output to a file to say what time it completed? And perhaps also send an email so to say the back up completed on XXXXX. This will be a Unix based script, so if anyone has any tips for me, had a look through Google, but they seem to be far more complicating than they should be. |
|
|
|
|
|
#2 (permalink) |
|
Diamond Member
![]() Join Date: Jul 2006
Location: Soul Chamber
Posts: 5,427
|
__________________
Laptop: Thinkpad X60: Core2Duo T7200 @ 2Ghz,1GB DDR2,110GB SATA -winXP ProSP2 Work Desktop: Core Duo E2180 @ 2Ghz,1.5GB DDR2,240GB HD - XP PRO SP2 Home: Core Duo E2180 2Ghz,1.5GB DDR2,Nvidia GForce 6200TB,320 GB (2x160GB) -Dual boot - XP / OSX 10.5.2 |
|
|
|
|
|
#3 (permalink) |
|
Diamond Member
![]() Join Date: Mar 2005
Location: /dev/null
Age: 22
Posts: 1,227
|
If your coping over a public network you can try to use the scp command to copy the files assuming your copying to a computer with ssh.
http://linux.about.com/od/commands/l/blcmdl1_scp.htm
__________________
Dell Inspiron 530 Q6600 Quad 3gb RAM Nvidia 8600 GT 500GB HD |
|
|
|
|
|
#4 (permalink) |
|
VIP Member
![]() Join Date: Apr 2006
Location: Kansas City, MO
Posts: 6,056
|
okay....
I am no Unix wizard, but I do have a beard. This is a general script you can use that will back up said directory to a network share. then you must set up what is called cron job to automate it to run every night, every week, every month, or whatever frequency you want it to. My method is using rsync but there are other methods out there. so here it goes, you will need to fill in your blanks to make it work. Code:
#!/bin/bash #this script will back up a set directory to a network share /sbin/rsync -u -a -t /path/to/source/directory /path/to/networkshare #please note that using the full file path is properly needed for security #depending on distro rysnc may be installed in a different path #most likely it lives in /bin, /sbin or /usr/bin, /usr/sbin #if not sure execute the bash command whereis rysnc to #find your path #now we will tell the script to mail the user when finished #see the man page for the mail command for proper syntax echo "Back up complete" | mail youremail@yourdomain.com -s back up complete your back up has been completed EOF copy/paste it into a plain text file and name it filename.sh then set up a cron job to run it. Of course you want to test it first. |
|
|
|
|
|
#5 (permalink) |
|
VIP Member
![]() Join Date: Apr 2006
Location: Kansas City, MO
Posts: 6,056
|
ooops I messed up, here is how it should look, remember you will need to plug in your file paths and your settings to make it work
Code:
#!/bin/bash #this script will back up a set directory to a network share /sbin/rsync -u -a -t /path/to/source/directory /path/to/networkshare #please note that using the full file path is properly needed for security #depending on distro rysnc may be installed in a different path #most likely it lives in /bin, /sbin or /usr/bin, /usr/sbin #if not sure execute the bash command whereis rysnc to #find your path #now we will tell the script to mail the user when finished #see the man page for the mail command for proper syntax echo "Back up complete" | mail youremail@yourdomain.com -s back up complete >> EOF your back up has been completed EOF |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Advanced XP script for start up program. | ANNR | Operating Systems | 0 | 06-04-2007 01:38 AM |
| Excelent scripts | rejavu | Internet Discussion | 0 | 12-17-2006 10:52 PM |
| need advice on getting or making a script | tlarkin | Computer Networking and Servers | 3 | 08-03-2006 09:45 PM |
| Thdd Is Back | MONKEY BOY | Internet Discussion | 6 | 06-23-2006 02:04 PM |
| 2 Fans Back To Back... | bcomatts | Computer Cases, Power Supplies and Cooling | 3 | 11-27-2005 04:28 AM |