linux - Different behaviour of bash script on supervisor start and restart -


i have bash script something, (for example:)

[program:long_script] command=/usr/local/bin/long.sh autostart=true autorestart=true stderr_logfile=/var/log/long.err.log stdout_logfile=/var/log/long.out.log 

and bounded supervisor. want add if check in script determine executed by:

  • supervisor> start long_script

or

  • supervisor> restart long_script

i want that:

if [ executed start command ]     echo "start" else     echo "restart" fi 

but don't know should in if clause. possible determine this? if not, how achieve different behaviour of script start , restart commands? please help.

i understand problem. don't know supervisor. please check whether idea works.

instantiate global string variable , put values variable before enter supervisor commands. here making each start , restart commands 2 bash programs.

program : supervisor_start.sh

#!/bin/bash echo "starting.." supervisor> start long_script supervisor_started_command="start" # 1 echo "started.." 

program : supervisor_restart.sh

#!/bin/bash echo "restarting.." supervisor> restart long_script supervisor_started_command="restart" # 1 echo "restarted.." 

now can see in "supervisor_started_command" variable :)

#!/bin/bash if [ $supervisor_started_command == "start" ]     echo "start" elif [ $supervisor_started_command == "restart" ]     echo "restart" fi 

well, don't know idea works or not..


Comments