| | |
Need help to write a backup script...
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jul 2009
Posts: 7
Reputation:
Solved Threads: 0
Helo frndz,
I'm novice in shell scripting...I need ur frnd help to write a shell script for taking backups. This script should use cp command to take backups. Script can read the list of directories and destination directory from a file or ask user for this info interactively...
Example:
Only two options -i (for interactive run) and "-f file" (to read backup info from a file) are allowed. When an invalid option is entered, script displays a message in shown below:
$ a2backup -r
syntax: a2backup [ -i/ -f file]
$ a2backup -i
Welcome to the Interactive Backup utility
Enter the source directory [/home/maskara/sya710]:
Enter the destination directory: /home/backup
What type of backup do you want ( [i]ncremental / [f]ull backup) [i]:
Follow symbolic link (Y/N) [n]:
Directory backed up successfully...
Plz help me to do this...
...
Thnx
I'm novice in shell scripting...I need ur frnd help to write a shell script for taking backups. This script should use cp command to take backups. Script can read the list of directories and destination directory from a file or ask user for this info interactively...
Example:
Only two options -i (for interactive run) and "-f file" (to read backup info from a file) are allowed. When an invalid option is entered, script displays a message in shown below:
$ a2backup -r
syntax: a2backup [ -i/ -f file]
$ a2backup -i
Welcome to the Interactive Backup utility
Enter the source directory [/home/maskara/sya710]:
Enter the destination directory: /home/backup
What type of backup do you want ( [i]ncremental / [f]ull backup) [i]:
Follow symbolic link (Y/N) [n]:
Directory backed up successfully...
Plz help me to do this...
...Thnx
Why don't you share the code you have so far so we can see what needs to be done? The incremental backup is going to be a little bit of work...
Last edited by sknake; Aug 21st, 2009 at 4:45 pm.
I'll get you started with the user input. Here is the sample output:
Now the actual script:
bash Syntax (Toggle Plain Text)
sk@sk:~/tmp$ ./ba.sh syntax: ./ba.sh [ -i/ -f file] sk@sk:~/tmp$ ./ba.sh -i Welcome to the Interactive Backup utility Enter the source directory [/home/maskara/sya710]: /ab Enter the destination directory [/home/backup]: /dc /ab /dc
Now the actual script:
bash Syntax (Toggle Plain Text)
#!/bin/bash d_srcdir="/home/maskara/sya710" d_dstdir="/home/backup" if ([ "$1" == "-i" ]); then echo "Welcome to the Interactive Backup utility" echo -n "Enter the source directory [${d_srcdir}]: " read srcdir if ! test $srcdir; then srcdir=${d_srcdir} fi echo -n "Enter the destination directory [${d_dstdir}]: " read dstdir if ! test $dstdir; then dstdir=${d_dstdir} fi echo ${srcdir} echo ${dstdir} else echo "syntax: ${0} [ -i/ -f file]" fi
![]() |
Similar Threads
- Make a desktop icon for python backup script OS X (Python)
- how to write perl script for "web services" using SOAP (Perl)
- Script to delete or backup logs at a specific time and under specific user (Shell Scripting)
- Please help me write this simple script (Shell Scripting)
- How I can write shell script for Sending Email (Shell Scripting)
- backup script for a table in MSSQL 2005 (MS SQL)
- Want to write script to back-up up Linux hdb drive to hdc drice (*nix Hardware Configuration)
- shell scripting help with backup script (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: How can i display time 5mins ago on Solaris 10
- Next Thread: Very new to this and would appreciate any help possible.
| Thread Tools | Search this Thread |







