Last active
December 13, 2015 17:09
-
-
Save apsamuel/4945794 to your computer and use it in GitHub Desktop.
Revisions
-
apsamuel revised this gist
Feb 13, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,14 @@ #!/bin/sh # onscheduler: turn the java when it is off # variables: savingcell="/root/bet/schedulerLog" #log path for scheduler applog="/root/bet/application.log" pid=$(pgrep -f '.*java.*bet.*Main.*' >/dev/null) #find pid. ret=$? #log result 0 - found, 1 - not found if [ $ret -ne 0 ] then #java is off /usr/bin/nohup java -Xmx512m -cp "/root/bet/lib/*:/root/bet/src/" Main >> $applog 2>&1 #turn it on with messages redirected to log. [ $(pgrep -f '.*java.*bet.*Main.*' |wc -l) -eq 1 ] && echo "Started by script on : $(date)" >> $savingcell || echo "Something bad happend, return code: $?" >> $savingcell else #java is on echo "was already on on : $(date)" >> $savingcell -
apsamuel created this gist
Feb 13, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/bin/sh # onscheduler: turn the java when it is off # variables: savingcell="/root/bet/schedulerLog" #log path pid=$(pgrep -f '.*java.*bet.*Main.*' >/dev/null) #find pid. ret=$? #log result 0 - found, 1 - not found if [ $ret -ne 0 ] then #java is off /usr/bin/nohup java -Xmx512m -cp "/root/bet/lib/*:/root/bet/src/" Main >> $savingcell 2>&1 #turn it on with messages redirected to log. [ $(pgrep -f '.*java.*bet.*Main.*' |wc -l) -eq 1 ] && echo "Started by script on : $(date)" >> $savingcell || echo "Something bad happend, return code: $?" >> $savingcell else #java is on echo "was already on on : $(date)" >> $savingcell fi