Advertisement
fydel

copy_plugin.sh

Aug 17th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.82 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. PATH=/usr/sbin:/usr/bin:/sbin:/bin
  4.  
  5. /usr/bin/wget -q http://happymining.de:7903/local_stats -O /tmp/local_stats.json
  6.  
  7. for code in $(/usr/local/bin/jshon -e miner_hash_rates -k < /tmp/local_stats.json)
  8. do
  9.   file="/etc/munin/plugins/miner_"$code
  10.  
  11.   filepayout="/etc/munin/plugins/miner_"$code"-payout"
  12.  
  13.   if [ -f $file ]; then
  14.         /bin/echo $file ' plugin exists.'
  15.         PATH=/usr/sbin:/usr/bin:/sbin:/bin
  16.     else
  17.         /bin/echo 'new plugin copied!'
  18.         /bin/cp miner_template $file
  19.         /bin/cp miner_template_payout $filepayout
  20.  
  21.  
  22.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code-day.png /home/p2pool/p2pool-drk/web-static/miner_$code-day.png
  23.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code-week.png /home/p2pool/p2pool-drk/web-static/miner_$code-week.png
  24.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code-month.png /home/p2pool/p2pool-drk/web-static/miner_$code-month.png
  25.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code-year.png /home/p2pool/p2pool-drk/web-static/miner_$code-year.png
  26.  
  27.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code""_payout-day.png /home/p2pool/p2pool-drk/web-static/
  28.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code""_payout-week.png /home/p2pool/p2pool-drk/web-static/
  29.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code""_payout-month.png /home/p2pool/p2pool-drk/web-static/
  30.         ln -s /var/cache/munin/www/localdomain/localhost.localdomain/miner_$code""_payout-year.png /home/p2pool/p2pool-drk/web-static/
  31.  
  32.         sed "s/XXX/$code/" template.html > /home/p2pool/p2pool-drk/web-static/$code.html
  33.         /usr/bin/service munin-node restart
  34.   fi
  35.  
  36. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement