This script checks the status of your Shiftnrg Delegate by using PHP.
Feel free to rewrite in Python or Bash.
This script will also check whether your node has forked or not.
When forked, it will stop Shift, restore to previous snapshot, and start Shift again.
There are some echo lines in this file.
When you redirect output to a log file in your crontab, these lines will show up.
See section Example crontab for more information.
Be sure to run this script after:
- You have installed shift-snapshot
- You have created a snapshot with shift-snapshot
Be sure that your php.ini allows passthru(). It's default that it does though, so just check if this script is not working.
sudo apt install php php-cli php-mbstring php-sqlite3
- shift-snapshot.sh: https://github.com/mrgrshift/shift-snapshot
You can clone this into every directory of your choosing. I usually just clone it into my home folder.
git clone https://github.com/lepetitjan/shift-checker.git
- Change settings inside checkdelegate.php to match your needs
- Edit your crontab with the example below
* * * * * php ~/shift-checker/checkdelegate.php >> ~/shift-checker/logs/checkdelegate.log 2>&1
Some users get the error:
sudo: no tty present and no askpass program specified
To fix it, follow these steps:
1. $ sudo nano /etc/sudoers.d/yourusername
2. Insert this: yourusername ALL=(ALL) NOPASSWD:ALL
Now your user does not have to type a sudo password anymore when shift-snapshot asked for one.
- Twitter: @lepetitjan
- Shiftnrg Slack: https://shiftnrg.slack.com/team/jan
Do you like/use my script(s)? Please consider donating the amount of a cup of coffee :-)
SHIFT: 7970982857025266480S
BTC: 1GbAWBiGyuybXJcjtyTvtH6hB5iezXNVdP
Seatrips (create snapshot when status is okay)
- Twitter: @seatrips
- Shiftnrg Slack: https://shiftnrg.slack.com/team/seatrips
Mrgr (Shift snapshots)
- Shiftnrg Slack: https://shiftnrg.slack.com/team/mrgr
- Github: https://github.com/mrgrshift