Skip to main content
deleted 12 characters in body
Source Link
#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is main_safe
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
#IMPORTANT: to die is very different from to freeze 
main_safe(){
trap "" HUP
while sleep 120; do
   main&
   wait 
done

}

#My name is main I like to keep restarting php master.php
#everytime it go away... remove wait and I will keep starting master.php with absolutely no reason.
#If you are paranoid you can program me to restart main_safe,
#But what will happen if you try to stop me? Bad things.. so... 
#IMPORTANT: to die is very different from to freeze 
main(){
trap "" HUP
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
main_safe& 
pstree -p | grep $! 

Is that acceptable?

#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is main_safe
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
main_safe(){
trap "" HUP
while sleep 120; do
   main&
   wait 
done

}

#My name is main I like to keep restarting php master.php
#everytime it go away... remove wait and I will keep starting master.php with absolutely no reason.
main(){
trap "" HUP
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
main_safe& 
pstree -p | grep $! 

Is that acceptable?

#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is main_safe
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
#IMPORTANT: to die is very different from to freeze 
main_safe(){
trap "" HUP
while sleep 120; do
   main&
   wait 
done

}

#My name is main I like to keep restarting php master.php
#everytime it go away... remove wait and I will keep starting master.php with absolutely no reason.
#If you are paranoid you can program me to restart main_safe,
#But what will happen if you try to stop me? Bad things.. so... 
#IMPORTANT: to die is very different from to freeze 
main(){
trap "" HUP
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
main_safe& 
pstree -p | grep $! 

Is that acceptable?

deleted 12 characters in body
Source Link
#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is check_processmain_safe
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
check_processmain_safe(){
trap "" HUP
while sleep 120; do
   main&
   wait 
done

}

#My name is main I like to keep restarting php master.php
#everytime it go away... remove wait and I will keep starting master.php with absolutely no reason.
main(){
trap "" HUP
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
check_process&main_safe& 
pstree -p | grep $! 

Is that acceptable?

#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is check_process
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
check_process(){
while sleep 120; do
   main&
   wait 
done

}

main(){
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
check_process& 
pstree -p | grep $! 

Is that acceptable?

#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is main_safe
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
main_safe(){
trap "" HUP
while sleep 120; do
   main&
   wait 
done

}

#My name is main I like to keep restarting php master.php
#everytime it go away... remove wait and I will keep starting master.php with absolutely no reason.
main(){
trap "" HUP
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
main_safe& 
pstree -p | grep $! 

Is that acceptable?

added 245 characters in body
Source Link
#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is check_process
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
check_process(){
while sleep 120; do
   main&
   wait 
done

}

main(){
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     #waitwait

done
}

#Remove & to do not go to the background... 
#Important:#nohup Dois not call this script from cron.. but only fromneeded ain initializationshell script or from a terminal. 
main&check_process& 
echo "I am in background andpstree my-p pid| isgrep $!" 

Is that acceptable?

#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

main(){
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     #wait

done
}

#Remove & to do not go to the background... 
#Important: Do not call this script from cron.. but only from a initialization script or from a terminal. 
main& 
echo "I am in background and my pid is $!"

Is that acceptable?

#!/bin/bash
#I am just like a system daemon... 
#I do not need nohup for work, and I should not be called from cron.

#My name is check_process
#I will become a separeted process even if my father dies... 
#i will check if main is still alive, and if dies i will restart it
#nohup is not needed inside shell script. 
check_process(){
while sleep 120; do
   main&
   wait 
done

}

main(){
while sleep 60; do

     php master.php & 
     #do whatever you want here

     #uncomment this to prevent two instances of master.php from going up maybe it is necessary:
     wait

done
}


#nohup is not needed in shell script
check_process& 
pstree -p | grep $! 

Is that acceptable?

added 56 characters in body
Source Link
Loading
added 56 characters in body
Source Link
Loading
Source Link
Loading