Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- filepath=$1
- echo $file
- #local hash
- hash_before=$(md5sum $file)
- # upload to remote
- scp -i srvkey.pem ${file} client.lan:/srv/client/
- #remote hash
- hash_after = ssh client.lan 'mv /srv/client/${file} /srv/client/tmp.${file}'
- #compare hashes
- if[hash_before == hash_after]
- then
- #rename remote
- ssh client.lan 'mv /srv/client/${file} /srv/client/tmp.${file}'
- #mv local to sent
- mv $file /srv/sent
- else
- echo "kala"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement