Reboot Script

This script allows you to reboot multiple remote Linux systems.

For more information on how to execute scripts in different environments, view the “Client Scripts” page.

Contents of Package

This scripts is composed of 2 python files:

  • ApiClient.py: ApiClient can be used to interface with the Edge Node’s API but will do nothing if run directly.

  • RebootScript.py: RebootScript must be run in the same folder with ApiClient.

Usage

This script will reboot all listed devices if the provided credentials have sudo permission and the Linux distro recognizes the “reboot” command. The script can be run from the command line as follows after navigating to its folder:

python RebootScript.py

Or, on a system with both Python 2 and 3 installed:

python3 RebootScript.py

When first run, it will create a subfolder named “Imports”. Place a properly formatted CSV file in this folder and execute the command again. The script will connect to each device in order, issuing a reboot command. Note that this process may take several minutes per device.

As with any software based power cycling of a remote device, there is a chance physical intervention will be required to restore communications. Proceed with caution.

CSV Formatting

The CSV file’s top row must include the following headers:

Edge Device IP,OS username,OS password

Each column's meaning is detailed below

Edge Device IP

The IP address or URL of the Edge device; this is the IP we will attempt to contact. By default, the IP address will be preceded with “http://” and the port used will be 8080, e.g. “192.168.0.10” will be read as “http://192.168.0.10:8080”. If a different port is expected, or the node is configured for https, that must be included, e.g. “https://192.168.0.10:8181”. Each Edge Device IP must be unique within the CSV.

OS username

The operating system username, not currently used by the script; it can be left blank.

OS password

The operating system password, not currently used by the script; it can be left blank

Output

While the script is running, files will be collected from the Import folder and moved into the Process folder. After running the script, the files will be moved into one of these:

  • Complete - The script has run successfully on at least one of the devices in the CSV file. Details of the operation can be found in the log.

  • Error - The script did not recognize the formatting of the CSV file. Check log for details.

  • Unrecognized - Files that don’t have the .csv extension will be moved here.

Logs

This script will generate its logs in RebootScript.log. It can be checked for further details if an error appears in the Complete report.

 

For assistance, please submit a ticket via our Support Portal, email autosol.support@autosoln.com or call 281.286.6017 to speak to a support team member.