Author: culley
Date: 20-04-03 14:17
Here is a little script I use every day. It created 3 links to the script: rget, rput and rs. calling the script by the different links does different things:
rput: scp a file to a remote machine. For example if you are in /home/foo and you type:
rput bar
then this expands to:
scp bar example.com:/home/foo/bar
rget reverses this to copy from the remote machine to the local machine.
And rs calls rsync and pushes all files in the current directory to the remote directory. rs requires a file named .rs in the current directory-- this file is a list of all files to exclude from the rsync
#!/bin/sh
# $Id: publish.sh,v 1.1 2002/11/24 14:49:27 culley Exp $
#
#
host="example.com"
dir=`pwd`
script=$0
case $script in
*rput)
cmd="scp $1 $host:$dir/$1"
break
;;
*rget)
cmd="scp $host:$dir/$1 ."
break
;;
*rs)
echo "rsync -zvt --modify-window=15 --progress -e ssh --exclude-from=$dir/.rs * $host:$dir/"
rsync -zvt --modify-window=15 --progress -e ssh --exclude-from=$dir/.rs * $host:$dir/
exit;
;;
*)
echo valid commands:
echo " rs <file_names> using rsync send all changes in the current directory to the server."
echo " rput <file_name> using scp send a singlular file to the server"
echo " rget <file_name> using scp get a singlular file from the server"
exit
;;
esac
echo $cmd
exec $cmd
|
|