Skip to content

Commit

Permalink
Merge pull request #3 from dfoderick/command-reboot
Browse files Browse the repository at this point in the history
add 'reboot' parameter to restart command. Hard restart vs soft restart.
  • Loading branch information
dfoderick authored Apr 24, 2018
2 parents 0298717 + 253eb98 commit f2da8bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fullcyclepy/backend/when_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def when_restart(channel, method, properties, body):

def dorestart(miner, command: MinerCommand):
if command.command:
showmsg = Fore.YELLOW + "{0}({1}) {2}".format(miner.name, '{}:{}'.format(miner.ipaddress, miner.port), command.command)
showmsg = Fore.YELLOW + "{0}({1}) {2} {3}".format(miner.name, '{}:{}'.format(miner.ipaddress, miner.port), command.command, command.parameter)
COMPONENTACTION.app.sendlog(showmsg)
#access = COMPONENTACTION.app.antminer.getaccesslevel(miner)
#if access == MinerAccessLevel.Restricted:
Expand All @@ -54,7 +54,11 @@ def dorestart(miner, command: MinerCommand):
#access = COMPONENTACTION.app.antminer.setminertoprivileged(miner)
#if access == MinerAccessLevel.Restricted:
# raise Exception('Could not set miner {0} to priviledged'.format(miner.name))
antminerhelper.restart(miner)
if command.parameter and command.parameter == 'reboot':
miner.set_ftp_port(COMPONENTACTION.app.configuration('discover.sshport'))
antminerhelper.reboot(miner, COMPONENTACTION.app.sshlogin())
else:
antminerhelper.restart(miner)
log = MinerLog()
log.createdate = datetime.datetime.utcnow()
log.minerid = miner.key()
Expand Down

0 comments on commit f2da8bd

Please sign in to comment.