aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qtopia/poboxserver/poboxserver/pbserver.sh
blob: e6067ed6ff13e94236bba34c134a3c3555b8104e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

killproc()
{
   pid=`/bin/ps -e x |
        /bin/grep $1 |
        /bin/grep -v grep |
        /bin/sed -e 's/^  *//' -e 's/ .*//'`
   [ "$pid" != "" ] && kill $pid
}

usage()
{
    echo "Usage: $0 {start|stop}"
}

if [ $# -lt 1 ] ; then usage ; exit ; fi

case "$1" in
start)
    echo -n "Start pbserver"
    # make sure lo interface is configured (otherwise qpobox will not bind to pbserver)
    ifconfig lo|grep 127.0.0.1 >/dev/null || ifconfig lo 127.0.0.1
    cd @palmtopdir@/pobox; ./pbserver > /dev/null &
    echo
    sleep 1
    ;;

stop)
    echo -n "Stop pbserver"
    killproc pbserver
    echo
    ;;

esac

exit 0