seems like BiblePay crashes randomly every few weeks,
(Anyone know how I can automate it to restart Biblepay if BiblePay crashes and to delete the explorer/tmp/index.pid file as well?)
This is a bit "rough" in that I should have parameterized the working directory, or at least made it a variable, but here you go:
#!/bin/bash
fname="/home/biblepay/explorer/tmp/index.pid"
if [[ -f "$fname" ]];
then
pid=$( echo $pid
ps -p $pid > /dev/null
r=$?
echo $r
if [ $r -eq 0 ]; then
exit 1
else
rm $fname
fi
fi
I added this to crontab to run periodically. In cases where the index.pid is still there but the process is gone, it simply removes the index.pid file. Hope this helps.
I dont know bash at all (nor do I barely know any linux haha), but just to be sure I understand:
-f is checking if the file exists
index.pid is the indexing lock file with its process ID number inside of it
ps -p checks if the process is running
$? is the value of the last output that ran and since the previous value is going to dev/null, its the exit code status
"0 for successful executions and 1 or higher for failed executions."
and so if the process is still running, the bash script just exits, otherwise the process is done and the index.pid file gets removed
COOL!
So looks like the file doesnt need a .sh extension, if you have "#!/bin/bash" at the top then linux knows its a bash script
chmod +x to set it as executable
===
Also I successfully used nginx to forward nodejs port 3001 to port 80
https://eladnava.com/binding-nodejs-port-80-using-nginx/===
Now I just need to figure out how to restart biblepayd if it crashes, systemd seemed a little complicated,
I may just use an infinite while loop bash script LOL