Skip to content

Commit

Permalink
Make init scripts LSB conformant
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Filippov committed Dec 16, 2011
1 parent f7315e2 commit 86f0901
Show file tree
Hide file tree
Showing 10 changed files with 533 additions and 623 deletions.
7 changes: 5 additions & 2 deletions openstack-nova.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

Name: openstack-nova
Epoch: 1
Version: 2011.3
Release: 3
Version: 2011.3
Release: 3
Summary: OpenStack Compute (nova)

Group: Development/Languages
Expand Down Expand Up @@ -648,6 +648,9 @@ fi
%files node-compute

%changelog
* Fri Dec 16 2011 Boris Filippov <bfilippov@griddynamics.com> - 2011.3
- Make init scripts LSB conformant

* Tue Aug 29 2011 Alessio Ababilov <aababilov@griddynamics.com> - 2011.3
- Drop openstack-noVNC dependency

Expand Down
126 changes: 58 additions & 68 deletions redhat/openstack-nova-ajax-console-proxy.init
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

#
# nova-ajax-console-proxy OpenStack Nova Web-based serial console proxy
# nova-ajax-console-proxy OpenStack Nova Web-based serial console proxy
#
# chkconfig: 2345 96 04
# description: OpenStack Nova Web-based serial console proxy
Expand All @@ -9,7 +10,7 @@
# pidfile: /var/run/nova/nova-ajax-console-proxy.pid

### BEGIN INIT INFO
# Provides: openstack-nova-ajax-console-proxy
# Provides: nova-ajax-console-proxy
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
Expand All @@ -28,88 +29,77 @@ suffix="ajax-console-proxy"
flgfile=/etc/nova/nova.conf
logfile=/var/log/nova/nova-$suffix.log
pidfile=/var/run/nova/nova-$suffix.pid
lckfile=/var/lock/subsys/openstack-nova-$suffix
lckfile=/var/lock/subsys/nova-$suffix
binfile=/usr/bin/nova-$suffix

start() {
if [ -f "$pidfile" ]; then
pid=`cat $pidfile`
checkpid $pid
r=$?
if [ "$r" -eq 0 ]; then
cmd=$(basename $binfile)
echo -n "$cmd is already running (pid $pid)"; passed
echo
exit 0
fi
fi
echo -n "Starting $prog: "
cd /var/lib/nova
/sbin/start-stop-daemon --start -b -c nova:nobody --make-pidfile --pidfile $pidfile --exec /usr/bin/nova-$suffix -- --flagfile=$flgfile --logfile=$logfile --pidfile $pidfile
sleep 1
if [ -f "$pidfile" ]; then
checkpid `cat $pidfile`
r=$?
if [ "$r" -eq 0 ]; then
touch $lckfile
success
else
failure
fi
else
failure
fi
echo
return
}
__pids_var_run "$binfile" "$pidfile"
retval=$?
if [ $retval -eq 0 ]; then
cmd=${binfile##*/}
echo -n "$cmd is already running (pid $pid)";
passed
echo
return
fi

stop() {
echo -n "Stopping $prog: "
if [ -n "`pidofproc -p $pidfile $binfile`" ] ; then
killproc -p $pidfile $binfile
else
failure $"Stopping $prog"
fi
retval=$?
[ $retval -eq 0 ] && rm -f $lckfile
echo
return $retval
echo -n "Starting $prog: "
cd /var/lib/nova
/sbin/start-stop-daemon --start -b -c nova:nobody --make-pidfile --pidfile $pidfile --exec $binfile -- --flagfile=$flgfile --logfile=$logfile --pidfile=$pidfile
sleep 1

__pids_var_run "$binfile" "$pidfile"
retval=$?
if [ $retval -eq 0 ]; then
touch $lckfile
success
else
failure
fi
echo
}

rh_status() {
status -p $pidfile $binfile
stop() {
echo -n "Stopping $prog: "
killproc -p $pidfile $binfile
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lckfile $pidfile
}

restart() {
stop
start
stop
start
}

case "$1" in
start)
start
;;
start
;;
stop)
stop
;;
stop
;;
status)
rh_status
retval=$?
if [ $retval -eq 3 -a -f $lckfile ] ; then
retval=2
fi
;;
status -p $pidfile $binfile
retval=$?
if [ $retval -eq 3 -a -f $lckfile ]; then
retval=2
fi
;;
restart)
restart
;;
restart
;;
force-reload)
restart
;;
condrestart)
if [ -n "`pidofproc -p $pidfile $binfile`" ] ; then
restart
fi
;;
if [ -n "`pidofproc-p$pidfile$binfile`" ]; then
restart
fi
;;
*)
echo "Usage: service openstack-nova-$suffix {start|stop|status|restart|condrestart}"
exit 1
;;
echo "Usage: service nova-$suffix{start|stop|status|restart|force-reload|condrestart}"
exit 1
;;
esac
exit $?
exit $retval
123 changes: 55 additions & 68 deletions redhat/openstack-nova-api.init
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

#
# nova-api OpenStack Nova API Server
# nova-api OpenStack Nova API Server
#
# chkconfig: 2345 96 04
# description: At the heart of the cloud framework is an API Server. \
Expand All @@ -14,7 +15,7 @@
# pidfile: /var/run/nova/nova-api.pid

### BEGIN INIT INFO
# Provides: openstack-nova-api
# Provides: nova-api
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
Expand All @@ -37,91 +38,77 @@ suffix="api"
flgfile=/etc/nova/nova.conf
logfile=/var/log/nova/nova-$suffix.log
pidfile=/var/run/nova/nova-$suffix.pid
lckfile=/var/lock/subsys/openstack-nova-$suffix
lckfile=/var/lock/subsys/nova-$suffix
binfile=/usr/bin/nova-$suffix

start() {
if [ -f "$pidfile" ]; then
pid=`cat $pidfile`
checkpid $pid
r=$?
if [ "$r" -eq 0 ]; then
cmd=$(basename $binfile)
echo -n "$cmd is already running (pid $pid)"; passed
echo
exit 0
fi
fi
echo -n "Starting $prog: "
cd /var/lib/nova
/sbin/start-stop-daemon --start -b -c nova:nobody --make-pidfile --pidfile $pidfile --exec /usr/bin/nova-$suffix -- --flagfile=$flgfile --logfile=$logfile --pidfile $pidfile
sleep 1
if [ -f "$pidfile" ]; then
checkpid `cat $pidfile`
r=$?
if [ "$r" -eq 0 ]; then
touch $lckfile
success
else
failure
fi
else
failure
fi
echo
return
}
__pids_var_run "$binfile" "$pidfile"
retval=$?
if [ $retval -eq 0 ]; then
cmd=${binfile##*/}
echo -n "$cmd is already running (pid $pid)";
passed
echo
return
fi

stop() {
echo -n "Stopping $prog: "
if [ -n "`pidofproc -p $pidfile $binfile`" ] ; then
killproc $pidfile
#dirty fix. old script do not kill all processes
killproc $binfile
echo -n "Starting $prog: "
cd /var/lib/nova
/sbin/start-stop-daemon --start -b -c nova:nobody --make-pidfile --pidfile $pidfile --exec $binfile -- --flagfile=$flgfile --logfile=$logfile --pidfile=$pidfile
sleep 1

__pids_var_run "$binfile" "$pidfile"
retval=$?
if [ $retval -eq 0 ]; then
touch $lckfile
success
else
failure $"Stopping $prog"
failure
fi
retval=$?
[ $retval -eq 0 ] && rm -f $lckfile
echo
return $retval
}

rh_status() {
status -p $pidfile $binfile

stop() {
echo -n "Stopping $prog: "
killproc -p $pidfile $binfile
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lckfile $pidfile
}

restart() {
stop
start
stop
start
}

case "$1" in
start)
start
;;
start
;;
stop)
stop
;;
stop
;;
status)
rh_status
retval=$?
if [ $retval -eq 3 -a -f $lckfile ] ; then
retval=2
fi
;;
status -p $pidfile $binfile
retval=$?
if [ $retval -eq 3 -a -f $lckfile ]; then
retval=2
fi
;;
restart)
restart
;;
restart
;;
force-reload)
restart
;;
condrestart)
if [ -n "`pidofproc -p $pidfile $binfile`" ] ; then
restart
fi
;;
if [ -n "`pidofproc-p$pidfile$binfile`" ]; then
restart
fi
;;
*)
echo "Usage: service openstack-nova-$suffix {start|stop|status|restart|condrestart}"
exit 1
;;
echo "Usage: service nova-$suffix{start|stop|status|restart|force-reload|condrestart}"
exit 1
;;
esac
exit $?
exit $retval
Loading

0 comments on commit 86f0901

Please sign in to comment.