scripts to:
- control (start, stop or powercycle) or get status on PoE or HiLink ports.
- allow MadGruber to pause device, reboot device etc https://github.com/RagingRectangle/MadGruber.
- git clone and copy config file
git clone https://github.com/dkmur/deviceControl.git && cd deviceControl && cp config.ini.example config.ini
- fill out details in config.ini, duplicate example section for each device you want to control
- for controlling HiLink relay: install ncat. Debian
sudo apt install ncat
, Ubuntusudo apt install nmap
- for controlling PoE switch: install snmp,
sudo apt install snmp
If your server isn't local, for PoE there is the option to have the snmp control over local server i.e. a rPI by setting up SSH key-based authentication. See https://linuxize.com/post/how-to-setup-passwordless-ssh-login/.
1 ./relay_poe_control.sh
, it will ask for inputs on what to execute or can be used as described in section MadGruber-scripts from commandline
2 ./devicecontrol.sh origin action
where:
- origin
- action = pauseDevice, unpauseDevice, quitPogo, startPogo (can also be used to restart pogo), rebootDevice, logcatDevice, clearGame or cycle (requires table below)
relay_poe_control.sh allows for inputs on command line so it can be controlled via MadGruber.
order of input: ./relay_poe_control.sh deviceName action port
where:
- deviceName = name of device as specified in config.ini
- action = start, stop or cycle
- port = port number or
all
Example can be found in MadGruber config folder
- will allow MadGruber to use MAD api for stuff like pause device, reboot device and restart pogo.
- set
pathStats
at least, as for now Im linking to Stats config.ini, no need to have it running just clone and fill out DB and MADmin sections https://github.com/dkmur/Stats - in case you want to power cycle based on origin add table below to STATSdb and fill out the details.
CREATE TABLE IF NOT EXISTS `relay` (
`origin` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
`port` int(6) NOT NULL,
`lastCycle` datetime NOT NULL DEFAULT current_timestamp(),
`totCycle` int(6) DEFAULT 0,
PRIMARY KEY (`origin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- for use of RebootMadDevice scripts you have to enable it in the config and create the table rmd in the STATSdb and create one entry per device with the details. https://github.com/GhostTalker/RebootMadDevice
CREATE TABLE IF NOT EXISTS `rmd` (
`origin` varchar(50) NOT NULL,
`ssh_ip` varchar(20) NOT NULL,
`ssh_port` int(6) NOT NULL,
`ssh_user` varchar(20) NOT NULL,
`dest_rmdpath` varchar(100) NOT NULL,
`dest_pyvenv` varchar(100) NOT NULL,
PRIMARY KEY (`origin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;