Script for backup the file and append the status of the copy in to the file with date and time

January 31, 2011 at 7:24 am | Posted in shell script | Leave a comment

root@test-server:~# cat a.sh

rsync -r -v /root/known_hosts /testing | sed “s/$/, $(date)/” >>/home/hariprakash/ab.txt

 

 

sed “s/$/, $(date)/” ==> append the date and time to the file

 

OUTPUT LOG:

root@test-server:~# cat /home/hariprakash/ab.txt

 

 

sending incremental file list,Sat Jan 29 15:54:08 IST 2011

 

known_hosts,Sat Jan 29 15:54:08 IST 2011

 

,Sat Jan 29 15:54:08 IST 2011

 

sent 10685 bytes received 31 bytes 21432.00 bytes/sec,Sat Jan 29 15:54:08 IST 2011

 

total size is 10608 speedup is 0.99,Sat Jan 29 15:54:08 IST 2011

 

sending incremental file list,Sat Jan 29 15:54:25 IST 2011

 

known_hosts,Sat Jan 29 15:54:25 IST 2011

 

,Sat Jan 29 15:54:25 IST 2011

 

sent 10685 bytes received 31 bytes 21432.00 bytes/sec,Sat Jan 29 15:54:25 IST 2011

 

total size is 10608 speedup is 0.99,Sat Jan 29 15:54:25 IST 2011

Advertisement

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.