Server Tools: Usage
Operating Server Tools: invocation, global flags and the effect of --yes, argument handling, output and exit codes, the interactive menu and what is only available in the menu or only via CLI.
Usage
Invocation
server-tools [--yes|-y] [--quiet|-q] <command> <action> [options]
server-tools # interactive menu
server-tools --version | -v
server-tools --config | -c
server-tools --help | -h
server-tools install | uninstall
The command names and their short forms:
| Command | Short form |
|---|---|
db |
database |
vhost |
|
user |
|
ssl |
|
cron |
|
firewall |
fw |
fail2ban |
f2b |
logs |
log |
status |
After installation the program is also available as st and servertools. All commands require root, except --version, --help and --config. The options of each command are listed in the CLI reference.
Global flags
| Flag | Effect |
|---|---|
--yes, -y |
Answers every confirmation prompt with "yes" |
--quiet, -q |
Accepted, but currently has no effect on the output |
The flags are recognized and removed anywhere in the argument list before the command is evaluated. An option value that is exactly -y or -q is therefore also read as a flag.
What --yes confirms
--yes replaces every prompt with "yes", including the destructive ones:
| Command | Prompt that is skipped |
|---|---|
db delete, db restore |
Deleting the database, overwriting on restore |
vhost create |
Overwriting an existing VHost |
vhost delete |
Deleting the VHost and, for VHosts with a DocumentRoot, deleting the entire directory /var/www/<domain>. Proxy VHosts have no DocumentRoot prompt, nothing under /var/www is deleted for them |
user create |
Continuing without an existing Apache VHost |
user delete |
Deleting the user |
ssl delete |
Deleting the certificate |
cron add |
Overwriting a cron file of the same name |
cron remove |
Deleting every file in /etc/cron.d that contains the search pattern |
fail2ban unban |
Unbanning from all jails |
db delete, vhost delete |
"Continue without backup?" after a failed backup |
Without
--yesthe answer to every prompt defaults to "no". A singley,Y,jorJis accepted.
Arguments
- Options have the form
--name value. Every option needs a value, except the switches--websocket,--drop-userand--errors. - Unknown options are silently ignored.
- If a required option is missing, the tool prints a
Usage:line and exits with code 1. server-tools <command> --helpshows the list of actions. Exceptions:statusignores arguments and always shows the status, andvhost audit --helponly prints a usage line and exits with code 1. There is no help per action.- Inputs are validated before anything is changed. The rules are described in Security and safeguards.
Output and exit codes
- Messages with
[INFO],[WARN]and[ERROR]go to stderr, results and lists to stdout. - Colors only appear if stderr is a terminal and
NO_COLORis not set. - Passwords that the tool generates or shows only appear if stdout is a terminal. In pipes and scripts there is a note instead (
db create) or nothing (user set-password). - Exit code 0 means success, 1 any error. A declined prompt (
Aborted.) also exits with 1.
If you pass a password via
--password, every local user can see it in the process list during the call, and it ends up in the shell history.
Interactive menu
sudo server-tools
The main menu shows the title line Server Tools v<version> and these entries:
| No. | Entry |
|---|---|
| 1 | Database Management ([mysql not installed] if the client or dump tool is missing) |
| 2 | Virtual Host Management |
| 3 | SSH User Management |
| 4 | SSL Certificate Management |
| 5 | Cron Job Management |
| 6 | Firewall Management |
| 7 | Fail2Ban |
| 8 | Log Viewer |
| 9 | System Status |
| 10 | Exit |
Each submenu asks for the values one by one. An error in an action returns to the menu, not out of the program.
Menu only
| Action | Menu |
|---|---|
| Assign a database to a different user (reassign) | Database Management |
Add a www redirect to an existing VHost |
Virtual Host Management |
| Add an HTTPS redirect to an existing VHost | Virtual Host Management |
| Recreate all certificates | SSL Certificate Management |
| Delete a firewall rule | Firewall Management |
| Enable or disable the firewall | Firewall Management |
CLI only
| Action | Command |
|---|---|
| Check VHosts against the template | vhost audit |
| Set ProxyPreserveHost per VHost | vhost create --preserve-host |
Example: set up a new site
server-tools vhost create --domain shop.example.com --php 8.3
server-tools ssl create --domain shop.example.com
server-tools db create --name shop_db --user shop_user
server-tools user create --domain shop.example.com --username shopdev
server-tools user add-key --username shopdev --key "ssh-ed25519 AAAA... dev@laptop"
server-tools firewall allow --port 443 --proto tcp