Skip to content

Commit f2da8bd

Browse files
authored
Merge pull request #3 from dfoderick/command-reboot
add 'reboot' parameter to restart command. Hard restart vs soft restart.
2 parents 0298717 + 253eb98 commit f2da8bd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

fullcyclepy/backend/when_restart.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def when_restart(channel, method, properties, body):
4545

4646
def dorestart(miner, command: MinerCommand):
4747
if command.command:
48-
showmsg = Fore.YELLOW + "{0}({1}) {2}".format(miner.name, '{}:{}'.format(miner.ipaddress, miner.port), command.command)
48+
showmsg = Fore.YELLOW + "{0}({1}) {2} {3}".format(miner.name, '{}:{}'.format(miner.ipaddress, miner.port), command.command, command.parameter)
4949
COMPONENTACTION.app.sendlog(showmsg)
5050
#access = COMPONENTACTION.app.antminer.getaccesslevel(miner)
5151
#if access == MinerAccessLevel.Restricted:
@@ -54,7 +54,11 @@ def dorestart(miner, command: MinerCommand):
5454
#access = COMPONENTACTION.app.antminer.setminertoprivileged(miner)
5555
#if access == MinerAccessLevel.Restricted:
5656
# raise Exception('Could not set miner {0} to priviledged'.format(miner.name))
57-
antminerhelper.restart(miner)
57+
if command.parameter and command.parameter == 'reboot':
58+
miner.set_ftp_port(COMPONENTACTION.app.configuration('discover.sshport'))
59+
antminerhelper.reboot(miner, COMPONENTACTION.app.sshlogin())
60+
else:
61+
antminerhelper.restart(miner)
5862
log = MinerLog()
5963
log.createdate = datetime.datetime.utcnow()
6064
log.minerid = miner.key()

0 commit comments

Comments
 (0)