Post
Topic
Board Announcements (Altcoins)
Re: BiblePay | 10% Charity | POBH CPU | Sanctuaries (Masternodes) | Orphans
by
coinsinspect
on 06/12/2019, 00:47:42 UTC
Hope this helps, for the Iquidus explorer, I have a crontab that tries to run the biblepay daemon every 5 minutes:

crontab -e

Code:
*/5 * * * * /home/biblepay-evolution/src/biblepayd > /dev/null 2>&1

Gave this to Rogue a little earlier tonight. You could use this also

#!/bin/bash
# checkprocess.sh

PROCESS=

check_running_process()
{
sudo ps -ef | grep -v grep | grep $PROCESS > /dev/null
result=$?
#echo "exit code: ${result}"

if [ "${result}" -eq "0" ] ; then
    echo "Process is Running"
    return 1
else
    echo "Process is Stopped"
    return 0
fi

}

echo Current Date and Time is: date +"%Y-%m-%d %T"
if (check_running_process); then
#Want to make sure it is not already being started
   sleep 10
   if (check_running_process); then
      echo "Restarting Process now"
      #syntax to restart the process
      #insert your command to restart the process that is not running <-- Here is the command you would put in to start the process if it has died
   fi
fi


here is my change if you are running several MN on same Linux :

Code:
./checkprocess.bash "biblepayd" "/sbin/runuser -l bbp -c './mn/biblepayd'"

Code:
root@station:~# cat checkprocess.bash
#!/bin/bash
# checkprocess.sh

echo process to check = $1
echo running command = $2

PROCESS=$1

check_running_process()
{
    sudo ps -ef | grep -v grep | grep -v checkprocess | grep $PROCESS > /dev/null
    result=$?
    #echo "exit code: ${result}"

    if [ "${result}" -eq "0" ] ; then
        echo "Process is Running"
        return 1
    else
        echo "Process is Stopped"
        return 0
    fi

}

if (check_running_process); then
#Want to make sure it is not already being started
   sleep 10
   if (check_running_process); then
      echo "Restarting Process now"
      #syntax to restart the process
      #insert your command to restart the process that is not running <-- Here is the command you would put in to start the process if it has died
      $2
   fi
fi


In crontab -e
Code:
*/5 * * * * /root/checkprocess.bash "biblepayd" "/sbin/runuser -l bbp -c './mn/biblepayd'" > /dev/null 2>&1