Monday, May 2, 2011

Shell script to send files to another computer

This is a simple shell script that can send a set of files to a particular PC. Also next time it sends, it will auto-create a backup file of previous sent files with data and time .

This script might be useful for those who want to read a log file.



filename=bacup_`date +%b_%d_%Y_%H_%M_%S`

ssh username@ipaddress_of_desti << EOT

mkdir /home/username/bin

cp /home/username/bin/ls
/home/username/bin/$filename

EOT
scp /bin/ls username@:
ipaddress_of_desti/home/username/bin/


exit


No comments:

Post a Comment