nodepower/bin/python3/npwstart
8623d74e
 #!/bin/bash
b98e8b95
 # Starts up the node power agent as a background process
 # and redirects output to a log file.
8623d74e
 
 APP_PATH="/home/$USER/bin"
 LOG_PATH="/home/$USER/log"
 
 AGENT_NAME="[n]pwAgent.py"
 
 PROCESS_ID="$(ps x | awk -v a=$AGENT_NAME '$7 ~ a {print $1}')"
 
 if [ -n "$PROCESS_ID" ]; then
   if [ "$1" != "-q" ]; then
     printf "node power agent running [%s]\n" $PROCESS_ID
   fi
 else
   printf "starting up node agent\n"
   cd $APP_PATH
98865bbb
   if [ "$1" != "" ]; then
     ./$AGENT_NAME $1
   else
     ./$AGENT_NAME >> $LOG_PATH/npwAgent.log 2>&1 &
   fi
8623d74e
 fi