Advertisement
Guest User

P2Pool auto restart

a guest
Nov 20th, 2012
1,518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.66 KB | None | 0 0
  1. #!/bin/bash
  2. P2POOL_DIR=~/p2pool
  3. EXISTINGPID=`pgrep -f run_p2pool.py -U bitcoin`
  4.  
  5. cd $P2POOL_DIR
  6. if git pull | grep -q 'Already up-to-date'; then
  7.         if [[ ! -z "$EXISTINGPID" ]]; then
  8.                 echo "No restart needed for p2pool"
  9.         else
  10.                 echo "No update for p2pool but found no running instance, launching..."
  11.                 ../pool.sh
  12.         fi
  13. else
  14.         echo "Starting new p2pool"
  15.         ../pool.sh
  16.         if [[ ! -z "$EXISTINGPID" ]]; then
  17.                 echo "Waiting for new p2pool to be ready"
  18.                 sleep 90
  19.                 echo "Killing old p2pool"
  20.                 kill $EXISTINGPID
  21.         fi
  22. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement