From 978edf74d9c517f471f737fbba598b34843e045d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 14 Oct 2006 21:25:58 +0000 Subject: Rearrange to first killa running process and then start anew (not either or). --- localsyncmail | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'localsyncmail') 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 -- cgit v1.2.3