summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2006-10-17 09:33:10 +0000
committerJonas Smedegaard <dr@jones.dk>2006-10-17 09:33:10 +0000
commita15ef1c30c080f62f2646aaffcb5e4310354f149 (patch)
tree5fb0801280093fdd5ad940a69a61a01aebe0a364
parent978edf74d9c517f471f737fbba598b34843e045d (diff)
Avoid compression for ssh connections to localhost.
-rwxr-xr-xlocalsyncmail25
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