Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Latest commit

 

History

History
61 lines (54 loc) · 2.87 KB

README.md

File metadata and controls

61 lines (54 loc) · 2.87 KB

deviceControl

scripts to:

Installation

  • 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, Ubuntu sudo 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/.

Usage

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)

MadGruber

Scripts

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

Devicecontrol

  • 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;
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;