wok-6.x view portmap/stuff/init.d/portmap @ rev 312
More deps and build-deps for gtk+
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Mar 03 00:15:12 2008 +0100 (2008-03-03) |
parents | |
children | 1b6281d68d9f |
line source
1 #!/bin/sh
2 # /etc/init.d/portmap : Start, stop and restart RPC portmapper on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start RPC portmapper at boot time, just put dropbear in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=portmap
12 DESC="RPC portmapper"
13 DAEMON=/usr/sbin/portmap
14 OPTIONS=
15 PIDFILE=/var/run/$NAME.pid
18 test -f $DAEMON || exit 0
20 case "$1" in
21 start)
22 if [ -f $PIDFILE ] ; then
23 echo "$NAME already running."
24 exit 1
25 fi
27 echo -n "Starting $DESC: $NAME... "
28 $DAEMON $OPTIONS
30 # registering PID
31 if [ $? -eq 0 ]; then
32 pidof -s $NAME > $PIDFILE
33 fi
34 status
36 if [ -f /var/run/portmap.upgrade-state ]; then
37 echo -n "Restoring old RPC service information..."
38 sleep 1 # needs a short pause or pmap_set won't work. :(
39 pmap_set </var/run/portmap.upgrade-state
40 rm -f /var/run/portmap.upgrade-state
41 echo "done."
42 fi
44 ;;
45 stop)
46 if [ ! -f $PIDFILE ] ; then
47 echo "$NAME is not running."
48 exit 1
49 fi
50 echo -n "Stopping $DESC: $NAME... "
51 kill `cat $PIDFILE`
52 rm -f $PIDFILE
53 status
54 ;;
55 restart)
56 pmap_dump >/var/run/portmap.state
57 $0 stop
58 $0 start
59 if [ ! -f /var/run/portmap.upgrade-state ]; then
60 sleep 1
61 pmap_set </var/run/portmap.state
62 fi
63 rm -f /var/run/portmap.state
64 ;;
65 *)
66 echo "Usage: $DAEMON {start|stop|reload|restart}"
67 exit 1
68 ;;
69 esac
71 exit 0