Skip to content

Instantly share code, notes, and snippets.

@iangreenleaf
Created June 2, 2011 02:04
Show Gist options
  • Save iangreenleaf/1003783 to your computer and use it in GitHub Desktop.
Save iangreenleaf/1003783 to your computer and use it in GitHub Desktop.
Bitcoin mining when idle
#!/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