Results 1 to 2 of 2
new at linux and writing script so please forgive this what I do so far
#! /bin/bash
cd /home/ops/Desktop/dir1
# Navigate to the correct directory
cp -p * /home/ops/Desktop/temp
# ...
- 01-20-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 19
just point in the right direction for this next bit
new at linux and writing script so please forgive this what I do so far
#! /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 backup-"$(date +%d-%b-%y)".tgz /home/ops/Desktop/temp
# this zip the content within temp folder this will call it backup with the system date
The next bit of this script I need to rysc this file across to across another linux server samba share for example tom/tom with the username tom and password tom for example. I then need it to report whether it fail or not
Thanks
Tom
- 01-20-2011 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
Using rsync isn't recommended because it's an old utility that isn't secure. Best to use OpenSSH's scp utility. You can't specify the password in the script so you'd have to generate public/private keys using the ssh-keygen utility. Then you would copy the public key to the destination host in tom's ~/.ssh directory. There's a few more steps involved but you can read about them in the manpages for ssh, scp, and ssh-keygen.
I've read there's a utility called expect where you supposedly can include the password in the script but I've never used it. Maybe someone else describe it.


Reply With Quote