php - Controlling Daemon Software via Shell Script with Cron -


i installed "the fat controller" software (http://fat-controller.sourceforge.net/) on server (ubuntu 14.04.5 lts) daemonise php script need run constantly.

it works perfectly, @ moment have control shell manually following commands.

starting

/etc/init.d/fatcontrollerd start

stopping

/etc/init.d/fatcontrollerd stop

is running?

/etc/init.d/fatcontrollerd status

basically, want setup shell script call cron same process manually, automatically every minute (check if it's running --> if is, nothing --> if not, start it).

when type "is running" while running command in shell, response "running". how can write shell script send "is running" command , run "start" command if, "is running" not respond "running"?

i inexperienced in shell, did previous daemon script work (that failed horribly). know how hooked cron, can't find syntax on how run these commands automatically, make decision , run command if necessary.

you can write script in php too, , running external process , output can use shell-exec function, can use like:

$output = shell_exec("/etc/init.d/fatcontrollerd status"); if ($output == "running") {     // need do!! } 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -