prdatur / phpminer

PHPMiner is a web interface for cgminer on linux machines
Other
34 stars 15 forks source link

Add custom commands to start / stop / restart mining process #22

Closed im-evo closed 10 years ago

im-evo commented 10 years ago

Motivation: better integration with BAMT, which uses /etc/init.d/ for mining initiation: mine start mine stop mine restart

prdatur commented 10 years ago

restart will not be used but the custom command for start/stop is a nice idea. So you have to configure it at all rpc client's, per default normal kill will be used, if something does not work as it should the user can remove the config and use kill again. I just encounterd a user where mine stop always breaks the hole system and he needed to reboot the rig. So users which know that "mine stop/start" always works could use it.

im-evo commented 10 years ago

Yes, I suppose, putting it in rpc client's config is a nice idea.

Also, there's strange behavior of cgminer both with "mine stop" and phpminer's "stop rig" button. When I connect to the screen that runs cgminer, press "q", fan settings (and probably memory/engine clock come back to normal). However, using "stop rig" would leave fans on the speed that was set in cgminer config. Is it an expected behavior or is it BAMT issue?

prdatur commented 10 years ago

The phpminer stop button does nothing else as "kill -9 process_id_of_miner_software" so the software is just killed. Normally the software should handle such kill commands, developer can catch those events and do things on that. for example reset the clock speed. I think mine stop also kills it, but a bit nicer than phpminer. By pressing Q button within the interface the miner software first reset all the values and then quits. That's the difference. There is an api command "quit" and i will also add the option to eather run the given custom command or use the api quit command or if nothing else is configured as a fallback use the current kill command.

im-evo commented 10 years ago

Just tried SIGTERM instead of SIGKILL (15 instad of 9) and it worked just if I shut cgminer manually, it's just it might not work when cgminer is hung.

JBrace1990 commented 10 years ago

This would also help with a problem I have - either command available just hangs my rigs. The only restart I've ever had work is:

Coldreboot -f

And there's usually a few syncs before it too.

prdatur commented 10 years ago

Please verify if it works for you.

neurocis commented 10 years ago

Confirmed working here, the following works very well for me for reboot on hard hung miner processes:

$config['commands'] = array(
    'stop' => 'kill -15 %pid%',
    'start' => null,
    'reboot' => 'sync; sleep 5; coldreboot -f',
);
prdatur commented 10 years ago

ok so closed