maybe fixed ssh connection
This commit is contained in:
parent
55c81f47fb
commit
9a9a74f19f
1 changed files with 9 additions and 8 deletions
|
|
@ -37,18 +37,19 @@ class WakeOnLan(commands.Cog):
|
||||||
async def sleep(self, ctx, amount=5):
|
async def sleep(self, ctx, amount=5):
|
||||||
if ctx.author.id == self.admin_id:
|
if ctx.author.id == self.admin_id:
|
||||||
#use ssh to login and shutdown
|
#use ssh to login and shutdown
|
||||||
ssh_client = asyncssh.connect(
|
async with asyncssh.connect(
|
||||||
self.stable_diffusion_ip,
|
self.stable_diffusion_ip,
|
||||||
username=self.stable_diffusion_login,
|
username=self.stable_diffusion_login,
|
||||||
password=self.stable_diffusion_password,
|
password=self.stable_diffusion_password,
|
||||||
timeout=10,
|
timeout=10,
|
||||||
)
|
) as ssh_client:
|
||||||
try:
|
try:
|
||||||
await ssh_client.run("shutdown /s")
|
result = await ssh_client.run("shutdown /s")
|
||||||
#await ssh_client.run("sudo shutdown -h now")
|
await ctx.send(result.stdout)
|
||||||
except:
|
#await ssh_client.run("sudo shutdown -h now")
|
||||||
self.logger.exception("WakeOnLan: Sleeping failed")
|
except:
|
||||||
await ctx.send("Sleeping failed")
|
self.logger.exception("WakeOnLan: Sleeping failed")
|
||||||
|
await ctx.send("Sleeping failed")
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue