diff options
author | Jonas Smedegaard <dr@jones.dk> | 2006-10-17 09:33:10 +0000 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2006-10-17 09:33:10 +0000 |
commit | a15ef1c30c080f62f2646aaffcb5e4310354f149 (patch) | |
tree | 5fb0801280093fdd5ad940a69a61a01aebe0a364 | |
parent | 978edf74d9c517f471f737fbba598b34843e045d (diff) |
Avoid compression for ssh connections to localhost.
-rwxr-xr-x | localsyncmail | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/localsyncmail b/localsyncmail index 03dc1d2..a6cd2f7 100755 --- a/localsyncmail +++ b/localsyncmail @@ -15,13 +15,30 @@ else user=$me fi -if [ "$user" = "$me" ] && [ "$host" = "localhost" ]; then +localsync() { + user=$1; shift + pkill -u $user offlineimap || [ $? -lt 2 ] offlineimap $@ +} + +remotesync() { + user=$1; shift + host=$1; shift + + if [ "$host" = "localhost" ]; then + ssh $user@$host pkill -u $user offlineimap || [ $? -lt 2 ] + ssh -X -e none -tt $user@$host offlineimap $@ + else + ssh -C $user@$host pkill -u $user offlineimap || [ $? -lt 2 ] + ssh -C -X -e none -tt $user@$host offlineimap $@ + fi +} + +if [ "$user" = "$me" ] && [ "$host" = "localhost" ]; then + localsync $user $@ else - ssh -C -X -e none $user@$host pkill -u $user offlineimap || [ $? -lt 2 ] - ssh -C -X -e none -tt $user@$host offlineimap $@ + remotesync $user $host $@ fi - exit 0 |