Created
June 2, 2011 02:04
-
-
Save iangreenleaf/1003783 to your computer and use it in GitHub Desktop.
Bitcoin mining when idle
This file contains 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 | |
# Monitors for signals from gnome-screensaver and activates or deactivates | |
# bitcoin miners accordingly. | |
# Params to the mining programs are all hardcoded. Change 'em manually. Leave the "&"s. | |
dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | \ | |
while read line; do | |
case "$line" in | |
*boolean\ true) | |
nice -n 19 minerd --threads 3 --algo sse2_64 --url http://my.pooled.mining:1234/ --user myusername1 --pass mypass1 & | |
cpu_pid=$! | |
poclbm -u myusername2 --pass=mypass2 -d 0 --host=http://my.pooled.mining --port=1234 & | |
gpu_pid=$! | |
;; | |
*boolean\ false) | |
kill $cpu_pid | |
kill $gpu_pid | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment