DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
hermes-reboot-wibs.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
3
4import click
5from pexpect import pxssh
6import getpass
7
8@click.command()
9@click.option('-n', '--dry-run', is_flag=True)
10@click.argument("crate", type=click.IntRange(3,5))
11def cli(dry_run, crate):
12 """"""
13 password = getpass.getpass('Password: ')
14
15 for i in range(1,6):
16 hostname = f'np04-wib-{crate}0{i}'
17 s = pxssh.pxssh()
18 s.login(hostname, 'root', password)
19 s.sendline('uptime') # run a command
20 s.prompt() # match the prompt
21 print(hostname, s.before.decode('utf-8')) # print everything before the prompt.
22 if not dry_run:
23 s.sendline('reboot') # run a command
24 s.prompt()
25 print(hostname, s.before.decode('utf-8')) # print everything before the prompt.
26 s.logout()
27
28if __name__ == "__main__":
29 cli()