Skip to content

Instantly share code, notes, and snippets.

@noqqe
Created June 4, 2011 10:32
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save noqqe/1007794 to your computer and use it in GitHub Desktop.
Save noqqe/1007794 to your computer and use it in GitHub Desktop.
Bitcoin Mining Script for Debian
#!/bin/bash
### BEGIN INIT INFO
# Provides: BitCoinMining
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: Start/stop BitCoing Mining poclbm-mod
### END INIT INFO
# I do not use my GPU a lot like the most Linux users (Minecraft excepted) and
# so i can spent it to a BitCoin MiningPool like deepbit.net
# Define as startup do:
# $ wget -O /etc/init.d/bitcoin https://gist.github.com/raw/1007794/bitcoin.sh
# chmod +x /etc/init.d/bitcoin
# update-rc.d bitcoin defaults
# Path to poclbm mining script
path_poclbm=/path/to/poclbm/dir/
# Pool data
POOLUSER=username@mail.com
POOLPASS=password
POOLURL=pit.deepbit.net
POOLPORT=8332
# Environment
BTCLOG=/var/log/bitcoin.log
BTCLOCK=/var/lock/bitcoinmining
case "$1" in
start)
echo $$ > $BTCLOCK
cd $path_poclbm
python poclbm-mod.py -d 0 -v -w 128 -f 60 -a 10 --user=$POOLUSER --pass=$POOLPASS -o $POOLURL -p $POOLPORT > $BTCLOG &
;;
stop)
if [ -r $BTCLOCK ]; then
BTCPID=$(cat $BTCLOCK)
# Increase PID because of its childy spawned command poclbm
((BTCPID++))
kill $BTCPID
rm $BTCLOCK
exit 0
fi
;;
*)
echo "Usage: /etc/init.d/bitcoin {start|stop}"
exit 1
;;
esac
exit 0
@ip-softsl
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment