我如何编写以下比特币/狗狗币/等脚本中央处理器命令:
/home/digger/cpuminer/minerd -o stratum+tcp://doge.pool.webxass.de:3333 -O <user>.<worker>:<worker_password>
执行,cron
以便当且仅minerd
当不是跑步?
我当前的 cron 脚本
* * * * * digger /home/digger/webxass
结果是方式进程过多minerd
:
top - 12:32:00 up 4:55, 3 users, load average: 17.45, 13.71, 7.98
Tasks: 141 total, 2 running, 139 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.1 sy, 72.7 ni, 27.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 502268 total, 463344 used, 38924 free, 25200 buffers
KiB Swap: 0 total, 0 used, 0 free, 325140 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14335 digger 20 0 374m 3540 2452 S 10.3 0.7 3:29.42 minerd
14344 digger 20 0 374m 3544 2452 S 10.3 0.7 2:29.48 minerd
14352 digger 20 0 374m 3540 2452 S 10.3 0.7 1:59.50 minerd
14527 digger 20 0 374m 3540 2452 S 10.3 0.7 0:39.83 minerd
14362 digger 20 0 374m 3540 2452 S 5.2 0.7 1:39.50 minerd
14373 digger 20 0 374m 3540 2452 S 5.2 0.7 1:24.51 minerd
14491 digger 20 0 374m 3540 2452 S 5.2 0.7 1:12.55 minerd
14500 digger 20 0 374m 3540 2452 S 5.2 0.7 1:02.55 minerd
14511 digger 20 0 374m 3540 2452 S 5.2 0.7 0:53.98 minerd
14519 digger 20 0 374m 3540 2452 S 5.2 0.7 0:46.49 minerd
14535 digger 20 0 374m 3540 2452 S 5.2 0.7 0:33.82 minerd
14544 digger 20 0 374m 3540 2452 S 5.2 0.7 0:28.38 minerd
14552 digger 20 0 374m 3536 2452 S 5.2 0.7 0:23.39 minerd
14560 digger 20 0 374m 3536 2452 S 5.2 0.7 0:18.78 minerd
14568 digger 20 0 374m 3536 2452 S 5.2 0.7 0:14.51 minerd
14576 digger 20 0 374m 3540 2452 S 5.2 0.7 0:10.51 minerd
14584 digger 20 0 374m 3540 2452 S 5.2 0.7 0:06.77 minerd
14592 digger 20 0 374m 3540 2452 S 5.2 0.7 0:03.25 minerd
1 root 20 0 26952 2644 1340 S 0.0 0.5 0:01.11 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
root@doge:~# killall minerd
root@doge:~# cd
也许运行数百个小minerd
进程同样高效,我不知道,但我宁愿只运行一两个。两个可能更有意义。
也可以看看
答案1
cron
不是完成任务的合适工具。Ubuntu 现在使用 Upstart 来执行服务和任务。您可以使用respawn
节。
答案2
来自食谱,这看起来是个正确的想法:
dig_coins stop/waiting
dig_coins start/running, process 9474
只是我不太清楚在哪里定义dig_coins
。