Skip to content

Instantly share code, notes, and snippets.

@clehner
Last active August 29, 2015 14:20
Show Gist options
  • Save clehner/7254413d02479104c706 to your computer and use it in GitHub Desktop.
Save clehner/7254413d02479104c706 to your computer and use it in GitHub Desktop.
cjdns updater script
#!/bin/sh
# update-cjdns
# Usage: put in crontab:
# 0 0 * * * /usr/local/sbin/update-cjdns
cd /opt/cjdns || exit 1
git pull | grep -q 'Already up-to-date' && exit 0
tmp="$(mktemp)"
trap "rm -f $tmp" 0
./do | tee $tmp
grep -q 'Build completed successfully' "$tmp" || exit 1
echo 'Restarting cjdns.'
systemctl cjdns restart
sleep 1
echo 'Checking peers.'
contrib/python/peerStats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment