source: trunk/init/samhain.startHPUX.in@ 515

Last change on this file since 515 was 1, checked in by katerina, 19 years ago

Initial import

File size: 1.7 KB
RevLine 
[1]1#!/sbin/sh
2
3# Allowed exit values
4#
5# 0 = success
6# 1 = failure
7# 2 = skip
8# 3 = reboot (now)
9
10# stdin is redirected from /dev/null
11# stderr, stdout are redirected to /etc/rc.log file (checklist mode)
12# or console (raw mode)
13
14# /usr, /var, /opt my not be available until run state 2
15
16PATH=/usr/sbin:/usr/bin:/sbin
17export PATH
18
19rval=0
20
21DAEMON=@sbindir@/@install_name@
22NAME=@install_name@
23
24run_the_command() {
25 if test -f /etc/rc.config
26 then
27 . /etc/rc.config
28 else
29 echo "ERROR: /etc/rc.config defaults file MISSING"
30 fi
31 if test "x${CONTROL_@install_name@}" = x0
32 then
33 rval=2
34 else
35 ${DAEMON} $1 2>/dev/null
36 ERRNUM=$?
37 if test x"$ERRNUM" != x0
38 then
39 echo "EXIT CODE: ${ERRNUM}"
40 rval=1
41 fi
42 fi
43}
44
45log_stat_msg () {
46case "$1" in
47 0)
48 echo "Service $NAME: Running";
49 break;
50 ;;
51 1)
52 echo "Service $NAME: Stopped and /var/run pid file exists";
53 break;
54 ;;
55 3)
56 echo "Service $NAME: Stopped";
57 break;
58 ;;
59 *)
60 echo "Service $NAME: Status unknown";
61 break;
62 ;;
63esac
64}
65
66
67case "$1" in
68 'start_msg')
69 echo "Starting the $NAME subsystem"
70 ;;
71
72 'stop_msg')
73 echo "Stopping the $NAME subsystem"
74 ;;
75
76 'start')
77 run_the_command start
78 exit $rval
79 ;;
80
81 stop)
82 run_the_command stop
83 #
84 # Remove a stale lockfile, if found
85 #
86 if test -f @mylockfile@; then
87 /bin/rm -f @mylockfile@
88 fi
89 /bin/rm -f @mylockdir@/${NAME}.sock
90 exit $rval
91 ;;
92
93 restart)
94 run_the_command restart
95 exit $rval
96 ;;
97
98 reload|force-reload)
99 run_the_command reload
100 exit $rval
101 ;;
102
103 status)
104 ${DAEMON} status
105 ERRNUM=$?
106 log_stat_msg ${ERRNUM}
107 exit ${ERRNUM}
108 ;;
109
110 *)
111 echo "Usage: @install_name@ {start_msg|stop_msg|start|stop|restart|reload|status}"
112 exit 1
113 ;;
114esac
115
116exit $rval
Note: See TracBrowser for help on using the repository browser.