Created
November 10, 2014 09:16
-
-
Save n00bsys0p/a40236c894dfd471cc27 to your computer and use it in GitHub Desktop.
NHZ Node Restart Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCREEN="screen -d -m -S" | |
USER="nhz_user" | |
SUDO="sudo -u $USER" | |
HOME="/home/$USER" | |
LOGFILE="/var/log/nhz-check.log" | |
if ! [[ $(ps aux | egrep "[S]CREEN.*NHZ_NODE") ]]; then | |
echo "Restarting NHZ node at $(date)" >> $LOGFILE | |
PUB_DIR="$HOME/nhz-pub" | |
cd $PUB_DIR | |
$SUDO $SCREEN NHZ_NODE $PUB_DIR/run.sh | |
sleep 120 | |
fi | |
if ! [[ $(ps aux | egrep "[S]CREEN.*NHZ_POOL") ]]; then | |
echo "Restarting NHZ pool at $(date)" >> $LOGFILE | |
POOL_DIR="$HOME/nhz-pool" | |
cd $POOL_DIR | |
$SUDO $SCREEN NHZ_POOL python $POOL_DIR/pool.py >> $POOL_DIR/pool.log | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment