Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
Skarafaz edited this page Sep 21, 2015 · 19 revisions

Usage1

Mercury-SSH reads configuration data from standard JSON files saved on the device's external storage. Simply put your configuration files into the folder named Mercury-SSH on the device's external storage and you are ready to go.

Writing a configuration file

Few lines of code are better than thousand words, so let's start with a sample configuration file:

{
    "name" : "Mediaserver",
    "host" : "192.168.0.150",
    "port" : 22,
    "user" : "an",
    "password" : "12345",
    "commands" : [ {
        "name" : "Restart plex",
        "sudo" : true,
        "cmd" : "service plexmediaserver restart"
    }, {
        "name" : "Shutdown",
        "sudo" : true,
        "cmd" : "shutdown -h now"
    }, {
        "name" : "Rsync music",
        "sudo" : true,
        "cmd" : "rsync -a --delete --exclude '.@__qini' --chown=root:root --chmod=D775,F664 /mnt/nas/music/ /var/data/music/"
    } ]
}

As you can see, a configuration file wrapps all the information you need to connect to a remote server and all the commands you want to send to it into a JSON object. The structure of this object is quite simple and is summarized below.

Server property summary

Property Type Notes Description
name string optional, defaults to "Server" Friendly name (used as label).
host string mandatory Target hostname or IP address.
port integer (1-65535) optional, defaults to 22 Target port.
user string mandatory Login user.
password string mandatory Login password.
commands array optional An array of objects defining available commands for the server. Read more for details.

Command property summary

Property Type Notes Description
name string optional, defaults to "Command" Friendly name (used as label).
sudo boolean optional, defaults to false State if the command needs to be executed as root.
cmd string mandatory The command itself.

Format

Each configuration file must be an UTF-8/16/32 encoded text file with .json extension.

Clone this wiki locally