/[pdpsoft]/trunk/grid-mw-security/ees/setup/ees.init.d
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/setup/ees.init.d

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1853 - (show annotations) (download) (as text)
Fri Jul 9 13:13:02 2010 UTC (11 years, 6 months ago) by aramv
File MIME type: text/x-dsrc
File size: 2976 byte(s)
Added another error message for failing SIGHUP
1 #!/bin/sh
2 #
3 # ees Starting, stopping and restarting the ees daemon.
4 #
5 # Author: Aram Verstegen
6 #
7 # chkconfig: 2345 99 01
8 # description: Starts and stops EES daemon
9
10
11 prog="ees"
12 glite="/opt/glite/"
13 fullprog="$glite/sbin/ees"
14 configfile="$glite/etc/ees.conf"
15 lockfile="/tmp/lock/subsys/ees"
16 nonprivaccount="ees"
17
18 # Source function library
19 if [ -f /etc/redhat-release ]; then
20 # Redhat-style
21 . /etc/rc.d/init.d/functions
22
23 start_ees_daemon="daemon --user $nonprivaccount $fullprog $configfile"
24 elif [ -f /etc/debian_version ]; then
25 # Debian-style
26 . /lib/lsb/init-functions
27 echo_success(){
28 echo success
29 }
30 echo_failure(){
31 echo failure
32 }
33 start_ees_daemon="start-stop-daemon --start --chuid $nonprivaccount --exec $fullprog $configfile"
34 elif [ -f /etc/SuSE-release ]; then
35 # SUSE-style
36 . /etc/rc.status
37 echo_success(){
38 rc_reset
39 rc_status -v
40 }
41 echo_failure(){
42 rc_failure
43 rc_status -v
44 }
45 start_ees_daemon="start-stop-daemon --start --chuid $nonprivaccount --exec $fullprog $configfile"
46 else
47 echo_success(){
48 echo success
49 }
50 echo_failure(){
51 echo failure
52 }
53 echo -n "Warning! Unable to determine the correct daemon runner for your distribution."
54 start_ees_daemon="exec $fullprog $configfile"
55 fi
56
57 start() {
58 echo -n "Starting EES: "
59 # Check if there should be an EES instance running
60 if [ -f $lockfile ]; then
61 eespid=`pidofproc $fullprog`
62 if [ -z "$eespid" ]; then
63 echo -n "removing stale lockfile... "
64 rm -f $lockfile
65 else
66 # EES already running
67 echo -n "already running. "
68 echo_failure
69 echo
70 exit $?
71 fi
72 fi
73 # Starting EES daemon now.
74 ${start_ees_daemon} && touch $lockfile
75 if [ $? -eq 0 ]; then
76 echo_success
77 else
78 echo -n "EES failed to start. "
79 echo_failure
80 fi
81 echo
82 }
83
84 stop() {
85 # Stopping EES
86 echo -n "Stopping EES: "
87 if [ -f $lockfile ]; then
88 # Killing EES now.
89 kill -TERM `pidofproc $fullprog`
90 rm -rf $lockfile
91 echo_success
92 else
93 # No EES running, nothing to kill
94 echo -n "no EES running. "
95 echo_failure
96 fi
97 echo
98 }
99
100 restart(){
101 echo -n "Restarting EES. "
102 eespid=`pidofproc $fullprog`
103 if [ -f $lockfile ]; then
104 kill -HUP $eespid
105 if [ $? -eq 0 ]; then
106 echo_success
107 else
108 echo -n "unable to restart. dead? "
109 echo_failure
110 fi
111 else
112 echo -n "EES not running. "
113 echo_failure
114 fi
115 echo
116 }
117
118 # See how we are called
119 case "$1" in
120 start)
121 start
122 ;;
123 stop)
124 stop
125 ;;
126 restart)
127 restart
128 ;;
129 status)
130 if [ -f $lockfile ]; then
131 echo "ees is running"
132 else
133 echo "ees is stopped"
134 fi
135 ;;
136 *)
137 echo "Usage $0 {start|stop|restart|status}"
138 exit 1
139 esac
140
141 exit 0

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28