Skip to content

Commit

Permalink
On calling sudo supervisor-config restart, the echo in start function
Browse files Browse the repository at this point in the history
closes the python subprocess shell. Hence moving it to end of function

Fixed ifmap-server script to start / stop java irond via supervisor

Closes-Bug #1587645

Change-Id: Icded331091910fcd9d033d2739f4438071f230f9
(cherry picked from commit 7245367)
  • Loading branch information
sanju-a authored and sbalineni committed Dec 12, 2016
1 parent 33e0f6f commit 332935f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 4 deletions.
20 changes: 20 additions & 0 deletions debian/contrail/debian/contrail-config.supervisor-config.upstart
Expand Up @@ -17,6 +17,26 @@ pre-start script
ulimit -d unlimited
ulimit -v unlimited
ulimit -n 4096
# cleanup subprocesses that are not reaped by supervisord, so that lifecycle management
# of the programs is with supervisord (config)
if [[ ! -z `ps -ef | grep contrail-discovery | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-discovery
fi
if [[ ! -z `ps -ef | grep irond.jar | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f irond.jar
fi
if [[ ! -z `ps -ef | grep contrail-api | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-api
fi
if [[ ! -z `ps -ef | grep contrail-schema | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-schema
fi
if [[ ! -z `ps -ef | grep contrail-svc-monitor | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-svc-monitor
fi
if [[ ! -z `ps -ef | grep contrail-device-manager | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-device-manager
fi
end script

#exec /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_config.conf
Expand Down
6 changes: 6 additions & 0 deletions debian/ifmap-server/debian/changelog
@@ -1,3 +1,9 @@
ifmap-server (0.3.2-1contrail3) precise; urgency=low
* Launch line updated to allow supervisor restart
on ifmap abnormal termination.

-- Sanju Abraham <sanjua@juniper.net> Tue, 31 May 2016 19:28:30 -0700

ifmap-server (0.3.2-1contrail2) precise; urgency=low
* Launch line updated to allow log-rotation correctly
(commit ab71b8d502fd6c34e439c82af931dd5a559a34d1)
Expand Down
5 changes: 4 additions & 1 deletion debian/ifmap-server/debian/scripts/ifmap-server
@@ -1,4 +1,7 @@
#!/bin/sh

cd /usr/share/ifmap-server
java -cp ./lib/ -jar ./irond.jar >> /var/log/contrail/ifmap-server-console.log 2>&1
# exec to allow supervisor reap for ifmap process, enabling proper detection and life cycle
# management of the ifmap process. Use the explicit Dlog4j option to allow ifmap process to
# be noticed by ps command and also for user contrail to run ifmap process
exec /usr/bin/java -jar ./irond.jar -Dlog4j.configuration=file:////usr/share/ifmap-server/log4j.properties
33 changes: 30 additions & 3 deletions rpm/contrail/supervisor-config.initd
Expand Up @@ -16,25 +16,52 @@ function log_failure_msg() {
PID_FILE=/var/run/supervisord-config.pid

function daemon_start() {
echo -n "Starting Supervisor Daemon for Contrail Config Package"
ulimit -s unlimited
ulimit -c unlimited
ulimit -d unlimited
ulimit -v unlimited
ulimit -n 4096
retval=false
socketon=false
if [[ ! -z `ps -ef | grep contrail-discovery | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-discovery
fi
if [[ ! -z `ps -ef | grep irond.jar | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f irond.jar
fi
if [[ ! -z `ps -ef | grep contrail-api | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-api
fi
if [[ ! -z `ps -ef | grep contrail-schema | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-schema
fi
if [[ ! -z `ps -ef | grep contrail-svc-monitor | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-svc-monitor
fi
if [[ ! -z `ps -ef | grep contrail-device-manager | grep -v grep | awk '{print $2}'` ]]; then
pkill -9 -f contrail-device-manager
fi
/usr/bin/supervisord -c /etc/contrail/supervisord_config.conf
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "supervisor-config start failed. checking lsof.."
retval=true
lsof | grep -i supervisord_config.sock
if [ $? -eq 0 ]; then
echo "Another program listening on same socket"
socketon=true
pid=`lsof | grep -i supervisord_config.sock | cut -d' ' -f3`
if [ "x$pid" != "x" ] ; then
ps uw -p $pid
fi
fi
fi
if [[ "retval" == true ]]; then
echo "supervisor-config start failed. checking lsof.."
if [[ "socketon" == true ]]; then
echo "Another program listening on same socket"
fi
else
echo -n "Started Supervisor Daemon for Contrail Config Package"
fi
}

function daemon_stop() {
Expand Down

0 comments on commit 332935f

Please sign in to comment.