/[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 1846 - (show annotations) (download) (as text)
Thu Jul 8 15:50:05 2010 UTC (11 years, 6 months ago) by aramv
File MIME type: text/x-dsrc
File size: 2545 byte(s)
Changed file checks
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 fullprog="/opt/glite/sbin/ees"
13 configfile="/opt/glite/etc/ees.conf"
14 lockfile="/var/lock/subsys/ees"
15 nonprivaccount="ees"
16
17 # Source function library
18 if [ -f /etc/redhat-release ]; then
19 # Redhat-style
20 . /etc/rc.d/init.d/functions
21
22 start_ees_daemon="daemon --user $nonprivaccount $fullprog --conf $configfile"
23 elif [ -f /etc/debian_version ]; then
24 # Debian-style
25 . /lib/lsb/init-functions
26 echo_success(){
27 echo success
28 }
29 echo_failure(){
30 echo failure
31 }
32 start_ees_daemon="start-stop-daemon --start --chuid $nonprivaccount --exec $fullprog $configfile"
33 elif [ -f /etc/SuSE-release ]; then
34 # SUSE-style
35 . /etc/rc.status
36 echo_success(){
37 rc_reset
38 rc_status -v
39 }
40 echo_failure(){
41 rc_failure
42 rc_status -v
43 }
44 start_ees_daemon="start-stop-daemon --start --chuid $nonprivaccount --exec $fullprog $configfile"
45 else
46 echo_success(){
47 echo success
48 }
49 echo_failure(){
50 echo failure
51 }
52 echo -n "Warning! Unable to determine the correct daemon runner for your distribution."
53 start_ees_daemon="$fullprog $configfile"
54 fi
55
56 start() {
57 echo -n "Starting EES: "
58 # Check if there should be an EES instance running
59 if [ -f $lockfile ]; then
60 eespid=`pidofproc $fullprog`
61 if [ -z "$eespid" ]; then
62 echo -n "Removing stale lockfile"
63 rm -f $lockfile
64 else
65 # EES already running
66 success "Looks like there is still another EES running."
67 echo
68 exit $?
69 fi
70 fi
71 # Starting EES daemon now.
72 exec ${start_ees_daemon} && touch $lockfile
73 if [ $? -eq 0 ]; then
74 echo_success
75 else
76 echo -n "EES failed to start"
77 echo_failure
78 fi
79 }
80
81 stop() {
82 # Stopping EES
83 echo -n "Stopping EES: "
84 if [ -f $lockfile ]; then
85 # Killing EES now.
86 killproc $fullprog
87 rm -rf $lockfile
88 echo_success
89 else
90 # No EES running, nothing to kill
91 echo "No EES running "
92 echo_failure
93 fi
94 }
95
96 restart(){
97 kill -HUP `pidofproc $fullprog`
98 }
99
100 # See how we are called
101 case "$1" in
102 start)
103 start
104 ;;
105 stop)
106 stop
107 ;;
108 restart)
109 echo "Restarting EES."
110 restart
111 ;;
112 status)
113 status $fullprog
114 ;;
115 *)
116 echo "Usage $0 {start|stop|restart|status}"
117 exit 1
118 esac
119
120 exit 0

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