Warning
The script runs manually but not automatically via cron. The cronjob triggers correctly, but the script doesn't execute. It's likely not a permission issue. Differences in environment or execution context between manual and cron execution might be causing the problem. I haven't had time to fully debug this yet!
Tip
This script automates the process of rebooting Unix-like operating systems such as Linux distributions (e.g., Ubuntu, Debian, CentOS) and BSD-based systems (e.g., FreeBSD, macOS). It's specifically built for system hosting Quilibrium nodes, running via a tmux session named "quil".
If you have installed your node via my guide Quilibrium node autoinstaller, then the below script will work for you.
Created by LaMAt /// connect with me on Farcaster or Twitter /// ♡ Donations
The script detects when a system restart is required, typically after system updates, and initiates the reboot process automatically.
The script assumes that there is a tmux session named quil running, and it terminates it before rebooting. You need to implement a system to automatically restart the node after any reboot. For instance, you can follow the steps outlined below (Step 1).
The script will be executed via a cronjob (set by default to run at 2 AM CET every day; adjust the cronjob settings according to your needs). It provides a 3-minute window to abort the reboot process in case you are working in your terminal when it is executed.
You only have to run this command once. This will setup a cronjob that will create your tmux session and run the node automatically after every reboot of your server. Shoutout to Peter Jameson (Quilibrium Discord community creator) for the idea.
echo '@reboot sleep 10 && bash -lc "export PATH=$PATH:/usr/local/go/bin && cd ~/ceremonyclient/node && tmux new-session -d -s quil '\''./poor_mans_cd.sh'\''"' | crontab -
If you need to delete the crontab:
Open the crontab file for editing with crontab -e
Locate the line corresponding to the cron job you want to delete and delete it. Press CTRL+X, then Y to save, then ENTER
Create a /root/scripts folder, then create the autoreboot.sh file, and open file
mkdir ~/scripts
touch ~/scripts/autoreboot.sh
nano ~/scripts/autoreboot.sh
Copy the autoreboot.sh script.
Paste the script in your terminal editor (to paste in your terminal simply right-click with your mouse, do not CTRL+V). Then press CTRL+X, then Y, then ENTER
Note
The script will log any successful reboot in /root/scripts/autoreboot-log.txt
. As long as you have created the "/root/scripts" folder, you don't need to create the "log-autoreboot.txt" file, the script will create it automatically.
Give execute permission to the owner (which should be "root")
chmod u+x ~/scripts/autoreboot.sh
crontab -e
Paste the below cronjob, then press X, then Y, then ENTER
0 2 * * * TZ="Europe/Amsterdam" /root/scripts/autoreboot.sh
The script will be executed at 2 AM CET everyday, change the cronjob settings according to your needs.
If you are happy with all this, you can buy me a cup of something with a small donation.
Donate QUIL
coming soon...
Donate ERC20
0x0fd383A1cfbcf4d1F493Dd71b798ebca89e8a013
Any token that lives on the Ethereum network or Layer2