summaryrefslogtreecommitdiff
path: root/localsyncmail
diff options
context:
space:
mode:
Diffstat (limited to 'localsyncmail')
-rwxr-xr-xlocalsyncmail23
1 files changed, 16 insertions, 7 deletions
diff --git a/localsyncmail b/localsyncmail
index 0a4bdd0..03dc1d2 100755
--- a/localsyncmail
+++ b/localsyncmail
@@ -1,18 +1,27 @@
#!/bin/sh
me=$(whoami)
-user=${1:-$me}
-host=${2:-localhost}
-#pkill -KILL -f offlineimap || nice x-terminal-emulator -e "offlineimap || echo 'Application died - hit return to quit!'; read"
-#pkill -KILL -f offlineimap || nice x-terminal-emulator -e \( offlineimap \|\| read \)
+user=$1
+if [ -n "$user" ]; then
+ host=$2
+ if [ -n "$host" ]; then
+ shift 2
+ else
+ host=localhost
+ shift
+ fi
+else
+ user=$me
+fi
if [ "$user" = "$me" ] && [ "$host" = "localhost" ]; then
- command="bash -s"
+ pkill -u $user offlineimap || [ $? -lt 2 ]
+ offlineimap $@
else
- command="ssh -C -X $user@$host bash -s"
+ ssh -C -X -e none $user@$host pkill -u $user offlineimap || [ $? -lt 2 ]
+ ssh -C -X -e none -tt $user@$host offlineimap $@
fi
-echo "pkill -u $user offlineimap || offlineimap" | $command
exit 0