Browse Source

Creating wrapper shell scripts for starting and stopping all the requisite services needed to run BWS

activeAddress
rajeshjayaraman 10 years ago
parent
commit
71d6bb3b54
  1. 31
      start.sh
  2. 18
      stop.sh

31
start.sh

@ -0,0 +1,31 @@
#!/bin/bash
mkdir -p logs
mkdir -p pids
# run_program (nodefile, pidfile, logfile)
run_program ()
{
nodefile=$1
pidfile=$2
logfile=$3
nohup node $nodefile >> $logfile 2>&1 &
PID=$!
if [ $? -eq 0 ]
then
echo "Successfully started $nodefile. PID=$PID. Logs are at $logfile"
echo $PID > $pidfile
return 0
else
echo "Could not start $nodefile - check logs at $logfile"
exit 1
fi
}
run_program locker/locker.js pids/locker.pid logs/locker.log
run_program messagebroker/messagebroker.js pids/messagebroker.pid logs/messagebroker.log
run_program bcmonitor/bcmonitor.js pids/bcmonitor.pid logs/bcmonitor.log
run_program emailservice/emailservice.js pids/emailservice.pid logs/emailservice.log
run_program bws.js pids/bws.pid logs/bws.log

18
stop.sh

@ -0,0 +1,18 @@
#!/bin/bash
stop_program ()
{
pidfile=$1
echo "Stopping Process - $pidfile. PID=$(cat $pidfile)"
kill -9 $(cat $pidfile)
rm $pidfile
}
stop_program pids/bws.pid
stop_program pids/emailservice.pid
stop_program pids/bcmonitor.pid
stop_program pids/messagebroker.pid
stop_program pids/locker.pid
Loading…
Cancel
Save