Question

Auto-restart process script.

  • Posted March 2, 2014

Hello. I have a process, that i want to restart if he dies. Process name is black.x86 Directory - /tmp/blackplanet/black.x86 System - CentOS 6.4 Can someone help with correct .sh script? Thanks! PS. Yeah yeah i googled alot, but nothing helped me =(

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

#!/bin/bash <br>if [ ! /usr/bin/pgrep black.x86 ];then /tmp/blackplanet/black.x86 & ;fi <br> <br>(sorry small typo, and i cant find an edit link)

dont break the lines <br> <br>[code] <br>#!/bin.bash <br>if [ ! /usr/bin/pgrep black.x86 ];then /tmp/blackplanet/black.x86 & ;fi <br>[/code] <br>

I wrote this script like this <br># !/bin/bash <br> <br>if [ ! /usr/bin/pgrep murmur.x86 ]; <br>then /tmp/murmur/murmur.x86 &; <br>fi <br>Saved as watchdogblack.sh. <br>When i try to execute it error message appears: <br> <br>watchdogblack.sh: line 4: syntax error near unexpected token ;' <br>watchdogblack.sh: line 4: then /tmp/murmur/black.x86 & ; <br>

put this on cron <br>if [ ! /usr/bin/pgrep black.x86 ];then /tmp/blackplanet/black.x86 & ;fi