Bitcoin Forum
May 13, 2024, 09:23:27 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Requesting a whitelist  (Read 701 times)
chrisrico (OP)
Hero Member
*****
Offline Offline

Activity: 496
Merit: 500


View Profile
December 27, 2011, 05:57:14 PM
 #1

I have a useful LinuxCoin setup script that I'd like to post in the thread in Project Development.

You set this up to run automatically upon boot and it will create all of the miner scripts, the auto start script, the restart script, etc based upon the devices installed in your system.

Code:
#!/bin/bash

xhost +
echo $DISPLAY > /home/user/.display

echo "Configuring on first run..."

while [ -z $IP ]; do
  sleep 1
  IP=`/sbin/ifconfig | grep 192.168 | awk '{ split($2, ip, ".");  print ip[4] }'`
done

sudo awk '{
  if($3 == "linuxcoin") {
    print "127.0.0.1       localhost stimbo102" >> "/etc/hosts.new"
  } else {
    print $0 >> "/etc/hosts.new"
  }
}' /etc/hosts

sudo mv /etc/hosts.new /etc/hosts

sudo hostname stimbo$IP

AMDOverdriveCtrl -h | awk -v ip=$IP '
function append(data, file) {
  print data >> file
}

function write(data, file) {
  print data > file
}

function write_miner(device) {
  file = "/home/user/miner" device ".sh"
  write("#!/bin/bash", file)
  append("cd /opt/miners/phoenix", file)
  append("sudo ./phoenix.py -u http://stimbo10." ip ":stimbo789@api.bitcoin.cz:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=" device, file)
  system("chmod +x " file)
}

function start_miner(device) {
  file = "/home/user/miner" device ".sh"
  system("lxterminal --title miner" device " --command sh " file)
}

function write_autostart() {
  file = "/home/user/.config/autostart/auto.desktop"
  write("[Desktop Entry]", file)
  append("Encoding=UTF-8", file)
  append("Name=coin", file)
  append("Exec=lxterminal --command \"sh /home/user/start.sh\"", file)
  append("Terminal=true", file)
}

function write_start() {
  file = "/home/user/start.sh"
  write("#!/bin/bash", file)
  append("sleep 20", file)
  append("xhost +", file)
  append("echo $DISPLAY > /home/user/.display", file)
  system("chmod +x " file)
}

function append_start(adapter, device) {
  file="/home/user/start.sh"
  append("AMDOverdriveCtrl -i " adapter " -b", file)
  append("lxterminal --title miner" device " --command sh /home/user/miner" device ".sh", file)
}

function write_restart() {
  file = "/home/user/restart.sh"
  write("#!/bin/bash", file)
  append("export DISPLAY=`cat /home/user/.display`", file)
  system("chmod +x " file)
}

function append_restart(adapter, device) {
  file="/home/user/restart.sh"
  append("pc=`ps waxuf | grep miner" device ".sh -c`", file)
  append("ld=`aticonfig --odgc --adapter=" device " | grep \"GPU load\" | cut -c 30-35 | cut -d % -f 1`", file)
  append("if [ $pc -lt \"2\" ] || [ $ld -lt \"50\" ] ; then", file)
  append(" kill `ps -ef | grep miner" device " | grep -v grep | awk \x27{print $2}\x27`", file)
  append(" lxterminal --title miner" device " --command sh /home/user/miner" device ".sh &", file)
  append(" date +\"%D %r miner" device " restarted\" >> /home/user/cron_job.log", file)
  append("fi", file)
}

BEGIN {
  n=0
  write_autostart()
  write_start()
  write_restart()
}
{
  if($5 ~ /active.*/) {
    device = substr($4, 1, length($4) - 1)
    devices[n++] = device
  }
}
END {
  for(device in devices) {
    print "Found device number " device " in adapter slot " devices[device]
    write_miner(device)
    append_start(devices[device], device)
    append_restart(devices[device], device)
    start_miner(device)
  }
}'

if [ -f /home/user/.config/autostart/firstrun.desktop ]; then
  rm /home/user/.config/autostart/firstrun.desktop
fi
1715635407
Hero Member
*
Offline Offline

Posts: 1715635407

View Profile Personal Message (Offline)

Ignore
1715635407
Reply with quote  #2

1715635407
Report to moderator
1715635407
Hero Member
*
Offline Offline

Posts: 1715635407

View Profile Personal Message (Offline)

Ignore
1715635407
Reply with quote  #2

1715635407
Report to moderator
The block chain is the main innovation of Bitcoin. It is the first distributed timestamping system.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Maged
Legendary
*
Offline Offline

Activity: 1204
Merit: 1015


View Profile
December 31, 2011, 07:08:19 PM
 #2

Sorry about the delay; I haven't had internet for several days.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!