Gregg Zigler
10 years ago
5 changed files with 94 additions and 39 deletions
@ -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 |
||||
|
|
@ -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…
Reference in new issue