blob: a6cd2f7eac4b247620980ef9ac798d741e85ac26 (
plain)
- #!/bin/sh
- me=$(whoami)
- user=$1
- if [ -n "$user" ]; then
- host=$2
- if [ -n "$host" ]; then
- shift 2
- else
- host=localhost
- shift
- fi
- else
- user=$me
- fi
- 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
- remotesync $user $host $@
- fi
- exit 0
|