summaryrefslogtreecommitdiff
path: root/localsyncmail
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2006-10-14 21:25:58 +0000
committerJonas Smedegaard <dr@jones.dk>2006-10-14 21:25:58 +0000
commit978edf74d9c517f471f737fbba598b34843e045d (patch)
tree9ebadb23508c2b6c33a219743b8171688f885405 /localsyncmail
parentf1431d4a04e057243f5bf6dfe621092698765693 (diff)
Rearrange to first killa running process and then start anew (not either or).
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