Changing func to certmaster in top level directories, also covered
[certmaster.git] / init-scripts / funcd
1 #!/bin/sh
2 #
3 # funcd Fedora Unified Network Control
4 ###################################
5
6 # LSB header
7
8 ### BEGIN INIT INFO
9 # Provides: funcd
10 # Required-Start: network
11 # Required-Stop:
12 # Default-Start: 3 4 5
13 # Default-Stop: 0 1 2 6
14 # Short-Description: Fedora Unified Network Control
15 # Description: Crazy simple, secure remote management.
16 ### END INIT INFO
17
18 # chkconfig header
19
20 # chkconfig: - 99 99
21 # description: Crazy simple, secure remote management.
22 #
23 # processname: /usr/bin/funcd
24
25 # Sanity checks.
26 [ -x /usr/bin/funcd ] || exit 0
27
28 SERVICE=funcd
29 PROCESS=funcd
30 DAEMON=/usr/bin/funcd
31 CONFIG_ARGS="--daemon"
32
33
34 FuncStatus()
35 {
36 ps wt? | grep "$DAEMON" 2>&1 > /dev/null
37 if [ "x$?" = "x0" ]; then
38 RVAL=0
39 echo "$DAEMON is running"
40 else
41 RVAL=3
42 echo "$DAEMON is not running"
43 fi
44 }
45
46 if [ -f /lib/lsb/init-functions ]; then
47 . /lib/lsb/init-functions
48 alias START_DAEMON=start_daemon
49 alias STATUS=FuncStatus
50 alias LOG_SUCCESS=log_success_msg
51 alias LOG_FAILURE=log_failure_msg
52 alias LOG_WARNING=log_warning_msg
53 elif [ -f /etc/init.d/functions ]; then
54 . /etc/init.d/functions
55 alias START_DAEMON=daemon
56 alias STATUS=status
57 alias LOG_SUCCESS=success
58 alias LOG_FAILURE=failure
59 alias LOG_WARNING=passed
60 else
61 echo "Error: your platform is not supported by $0" > /dev/stderr
62 exit 1
63 fi
64
65
66 RETVAL=0
67
68 start() {
69 echo -n $"Starting func daemon: "
70 START_DAEMON $PROCESS $CONFIG_ARGS
71 RETVAL=$?
72 echo
73 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
74 return $RETVAL
75 }
76
77 stop() {
78 echo -n $"Stopping func daemon: "
79 killproc $PROCESS
80 RETVAL=$?
81 echo
82 if [ $RETVAL -eq 0 ]; then
83 rm -f /var/lock/subsys/$SERVICE
84 rm -f /var/run/$SERVICE.pid
85 fi
86 }
87
88 restart() {
89 stop
90 start
91 }
92
93 # See how we were called.
94 case "$1" in
95 start|stop|restart)
96 $1
97 ;;
98 status)
99 STATUS $PROCESS
100 RETVAL=$?
101 ;;
102 condrestart)
103 [ -f /var/lock/subsys/$SERVICE ] && restart || :
104 ;;
105 reload)
106 echo "can't reload configuration, you have to restart it"
107 RETVAL=$?
108 ;;
109 *)
110 echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
111 exit 1
112 ;;
113 esac
114 exit $RETVAL
115