Results 1 to 3 of 3
Hi guys I be ask to write a bash script at work but could do with help with my first to understand some the syntax. I would be grateful for ...
- 01-19-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 19
Help with my first bash script noob but fast learner
Hi guys I be ask to write a bash script at work but could do with help with my first to understand some the syntax. I would be grateful for any help

Copy folder the subs folder within to a folder name temp
The files within the temp file are then tar
Then this tar file is check to make sure if this is successful (if successful is carries if not it’s E-mails a error message
The file is then rsync across to another server for example tom/tom/backup (creditionals for server username tom , password tom)
The way the backup will work is that the tar will have a naming convection for example 11-jan-11
The script will then look at the backup folder and if it find anything older than 5 days for example in this case 6-Jan-11 it would delete 4-jan-11, 5-jan-11 etc.
It will then E-mail reporting a success
Thanks
Tom
- 01-19-2011 #2Just Joined!
- Join Date
- Jan 2011
- Posts
- 19
This what I done so far just need point the right direction please
#! /bin/bash
cd /home/ops/Desktop/dir1
# Navigate to the correct directory
cp -p * /home/ops/Desktop/temp
# copy the data within dir1 into a new folder name temp. The -p preserves the modification date and time etc
cd /home/ops/Desktop/temp
tar czvf test="$(date +%d-%b-%y".tgz /home/ops/Desktop/temp
regarding the last line here could some how I can save the tar with the date as the naming convetion please as you probably can tell mine won't work
- 01-19-2011 #3Just Joined!
- Join Date
- Jan 2011
- Posts
- 19


Reply With Quote
