I am new to unix/linux and need a shell script to start a program if it is not running. The program's name is "literaail" and it has a log located "/local/publish/mtc_preprint/util/Literail.log" on a server. This program is supposed to print this "Starting ftp check for Get_Job1." statement once every 30 seconds. If it doesn't, I need a shell script to start the process. Currently I am doing it manually using these commands:
ps -ef | grep ftp_util_mtc_pp.sh
ps -ef | grep literail ( this command lists the jar file related to the literail program)
kill "parentjobnumber" "childjobnumber"
./ftp_util_mtc_pp.sh & ( this command restarts the process ).
I have a "ftp_util_mtc_pp.sh" file, inside this file, i have the following commands:
#!/bin/bash
utildir="/local/publish/mtc_preprint/util"
cd $utildir
java -jar LiteRail_3.0.1.jar literail.properties > /dev/null 2>&1
exit
Can someone help me with the shell-script. Thank you.