GoAdmio

load

Download this server's saved settings (admin contacts, API keys, cron jobs, backup and rclone configuration) from the GoAdmio configuration server, and fill in whatever is still empty

On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · Security · See also


Overview

/go/load sets up a server from a copy of its settings stored on the GoAdmio configuration server (go.blackhost.com). It is typically used on a new or rebuilt server so that you don't have to type everything again.

It identifies the server by its hostname and proves the request with a configuration password. It then downloads:

It is fill-in-the-blanks. A setting that already has a value on this server is not overwritten, except where noted in What is fetched.


Quick start

# First run on a server: pass the configuration password
/go/load 'your-config-password'

# Later runs: uses the saved password in /etc/config
/go/load

[!WARNING] A password typed on the command line is saved in plain text in /var/log/go/load.log and can be seen in the process list and shell history. See Security.


Syntax

/go/load [password] [hostname]
Form Behavior
/go/load Uses the password stored in /etc/config and this server's hostname. If /etc/config doesn't exist, the command exits with status 1 and prints nothing.
/go/load <password> Uses this password and runs the one-time import again.
/go/load <password> <hostname> Same, but the settings are requested under the hostname you give instead of this server's own.

Arguments

Position Argument Required Default Notes
1 <password> No The value in /etc/config The configuration password. It is turned into a hash before it is sent (see Password).
2 <hostname> No The contents of /etc/hostname The name the settings are registered under. It must contain at least two dots, such as server1.example.com.

There are no --option value pairs.


Output

The command prints nothing when it works. It also prints nothing when it decides not to do anything.

Situation Result
Settings fetched No output, exit status 0.
No password argument and no /etc/config No output, exit status 1.
Hostname has fewer than two dots No output, exit status 0. Nothing is fetched.
Configuration server unreachable No output. Each request gives up after 5 seconds and isn't retried.
Wrong password No output. The server returns nothing, so nothing is changed.

To confirm that something was imported, check the Config table or the files listed in What is fetched, for example:

sqlite3 /var/lib/sqlite/config.db "select AdminEmail,CronEmail from Config"

Examples

# First setup of a new server, passing the configuration password
/go/load 'your-config-password'
# Fetch the settings registered under a different hostname
/go/load 'your-config-password' server1.example.com
# Run the one-time import again without typing the password (uses /etc/config)
rm /usr/local/goadmio/db/load.db
/go/load
# Check that the crontab was installed
crontab -l -u root

Troubleshooting

Symptom Likely cause Fix
Nothing happens and the exit status is 1 No password argument and no /etc/config. Run /go/load '<password>'.
Nothing happens and the exit status is 0 The hostname has fewer than two dots. Set a full hostname with hostname, or pass one as the second argument.
Settings are not imported on a second run The one-time import has already run. Pass the password again, or delete /usr/local/goadmio/db/load.db. See One-time import.
Settings weren't imported on the first run either The configuration server was unreachable, or the password was wrong. The marker file is created before the downloads start, so a failed first run is not retried automatically. Fix the problem, then run /go/load '<password>' again.
A value on this server wasn't replaced Only empty values are filled. Edit the value in GoAdmio, or clear it first.
Admin contacts and Cloudflare token weren't imported The server's AdminEmail didn't contain an @, so the contacts group is skipped, and the Cloudflare token needs it too. Check the settings stored for this hostname.
The crontab wasn't installed Root's crontab already has more than one line. Edit it with crontab -e, or empty it before running.
Backup or rclone file wasn't created The file already exists, or the server has no copy of it. These files are checked on every run. Check the file in /var/go/etc/ or /root/.config/rclone/.
Permission denied while writing a configuration file The files are written without sudo. Run the command as root.

Details

How it works

flowchart TD
    A["load [password] [hostname]"] --> B{"Password given?"}
    B -- "Yes" --> C["Delete marker, hash the password"]
    B -- "No" --> D{"/etc/config exists?"}
    D -- "No" --> X["Exit 1"]
    D -- "Yes" --> E["Use saved password"]
    C --> F["Pick hostname"]
    E --> F
    F --> G{"2+ dots and a password?"}
    G -- "No" --> Z["Do nothing"]
    G -- "Yes" --> H{"Marker file exists?"}
    H -- "No" --> I["Create marker, then run the one-time import"]
    H -- "Yes" --> J["Skip the import"]
    I --> K["Fetch missing server files"]
    J --> K
  1. Logs the call, including the arguments, to /var/log/go/load.log.
  2. If a password was given, deletes the marker file and turns the password into a hash. Otherwise reads the hash from /etc/config, or exits with status 1 if the file doesn't exist.
  3. Uses the second argument as the hostname, or /etc/hostname.
  4. Stops quietly if the hostname has fewer than two dots or there is no password.
  5. If the marker file /usr/local/goadmio/db/load.db doesn't exist, creates it, then runs the one-time import.
  6. Checks the five server files and downloads any that are missing.

Password

The password you give is never sent as typed. The command sends the MD5 hash of the text [<password>], including the square brackets. If you use /etc/config, it must contain that hash, not the plain password. The script does not create /etc/config.

One-time import

The first block of work runs only once, controlled by the marker file /usr/local/goadmio/db/load.db:

What is fetched

Every value is requested separately from the configuration server, with one attempt and a 5-second timeout. Values are trimmed of extra spaces where noted in the script.

Group Keys requested Where it goes Applied when
Admin contacts and alerts AdminEmail, CronEmail, AdminMobile, QueueNo, WAInstanceID, WAAPIKey, SSHAlert, IMAPAlert Config table in /var/lib/sqlite/config.db The server's AdminEmail contains @, and the local AdminEmail is empty. All eight values are written together.
Cloudflare account CloudflareAccountID Config table The value isn't empty and the local one is empty.
Cloudflare token CloudflareAPIToken Config table The value isn't empty, the server's AdminEmail isn't empty, and the local token is empty.
ResellerClub ResellerclubIP, ResellerclubUserID, ResellerclubAPIKey Config table Each one separately, when the value isn't empty and the local one is empty.
PHP functions disable_functions Applied with disablefunctions The value contains a comma. This replaces the current setting, and is not limited to empty values.
Root crontab Crontab Installed as root's crontab Root's crontab has no more than one line, and the value isn't empty.
Timeout Timeout /etc/timeout The file doesn't exist and the value is 30 or more.
Uptime Uptime /var/go/etc/uptime The file doesn't exist and the value isn't empty.
Final step Runs /go/basic After everything above. This helper isn't listed in the command index.

On every run, whether or not the import has already happened, the command also downloads these files if they are missing and the server has a copy:

File Used by
/var/go/etc/backup.conf backup
/var/go/etc/secondary.conf Backup settings
/var/go/etc/tertiary.conf Backup settings
/var/go/etc/snapshot.conf snapshot
/root/.config/rclone/rclone.conf rclone remote storage

Existing files are never overwritten.

Known limitations


Security

This command downloads settings that end up in root's crontab, PHP's configuration, and API credentials, so the way it handles passwords and the connection matters.


See also

Command Description
save Save the server configuration
config Create GoAdmio's config.php, which stores the database and SSH login settings
hostname Change the server hostname and set up GoAdmio, mail, and SSL for it
email Change the administrator email address GoAdmio uses for server notifications
cron Rebuild GoAdmio's cron jobs, server-wide or for one domain
disablefunctions Show, set, or clear PHP's disable_functions setting in every php.ini on the server
backup Back up one or all GoAdmio accounts to local disk or remote storage
snapshot Back up, list, check, restore, and delete restic snapshots of hosting accounts
uptime Monitor multiple server IPs for uptime/downtime