forked from evolix/evobackup
Better help message composition and formating
This commit is contained in:
parent
2ad1032f9d
commit
05c3715c6a
|
@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* Better help message composition and formating
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
4
bkctld
4
bkctld
|
@ -36,6 +36,10 @@ fi
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||||
|
if [ "$#" = "0" ]; then
|
||||||
|
show_help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
while :; do
|
while :; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|-\?|--help)
|
-h|-\?|--help)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Run check on all expected incs of all jails
|
# Description: Run check on all expected incs of all jails
|
||||||
# Usage: check-incs all
|
# Usage: check-incs all
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Run check on jails (NRPE output)
|
# Description: Run check on jails (NRPE output)
|
||||||
# Usage: check-jails
|
# Usage: check-jails
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Run check on the last inc of all jails
|
# Description: Run check on the last inc of all jails
|
||||||
# Usage: check-incs last
|
# Usage: check-incs last
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Run check on jails (NRPE output)
|
# Description: Run check on jails (NRPE output)
|
||||||
# Usage: check-setup
|
# Usage: check setup
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Update firewall rules of <jailname> or all
|
# Description: Update firewall rules
|
||||||
# Usage: firewall <jailname>|all
|
# Usage: firewall [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Make incremental inc of all jails
|
# Description: Make dated copies (incs) of jails
|
||||||
# Usage: inc
|
# Usage: inc
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Init jail <jailname>
|
# Description: Initialize a new jail
|
||||||
# Usage: init <jailname>
|
# Usage: init <jailname>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Set or get allowed(s) ip(s) of <jailname>
|
# Description: Set or get allowed(s) ip(s)
|
||||||
# Usage: ip <jailname> [<ip>|all]
|
# Usage: ip <jailname> [<ip>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Check if a jail is on or not
|
# Description: Check if a SSH server is on (exit 0) or not (exit 100)
|
||||||
# Usage: is-on <jailname>
|
# Usage: is-on <jailname>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Set or get ssh pubic key of <jailname>
|
# Description: Set or get ssh pubic key
|
||||||
# Usage: key <jailname> [<keyfile>]
|
# Usage: key <jailname> [<keyfile>]
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# List jails
|
# Description: List jails
|
||||||
# Usage: list
|
# Usage: list
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Set or get ssh port of <jailname>
|
# Description: Set or get SSH port
|
||||||
# Usage: port <jailname> [<port>|auto]
|
# Usage: port <jailname> [<port>|auto]
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Reload jail <jailname> or all
|
# Description: Reload SSH server
|
||||||
# Usage: reload <jailname>|all
|
# Usage: reload [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Remove jail <jailname> or all
|
# Description: Remove jail and all dated copies (incs)
|
||||||
# Usage: remove <jailname>|all
|
# Usage: remove <jailname>|all
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Restart jail <jailname> or all
|
# Description: Restart SSH server
|
||||||
# Usage: restart <jailname>|all
|
# Usage: restart [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Remove old incremtal inc of all jails
|
# Description: Remove old dated copies (incs) according to policy
|
||||||
# Usage: rm
|
# Usage: rm
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Start jail <jailname> or all
|
# Description: Start SSH Server
|
||||||
# Usage: start <jailname>|all
|
# Usage: start <jailname>|all
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Make and display stats on jails (size, lastconn)
|
# Description: Display stats on jails (size, last connection…)
|
||||||
# Usage: stats
|
# Usage: stats
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Print status of <jailname> (default all jail)
|
# Description: Display status of SSH server
|
||||||
# Usage: status [<jailname>]
|
# Usage: status [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Stop jail <jailname> or all
|
# Description: Stop SSH server
|
||||||
# Usage: stop <jailname>|all
|
# Usage: stop [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Sync jail <jailname> or all to another node
|
# Description: Sync jail configuration and state on other node(s)
|
||||||
# Usage: sync <jailname>|all
|
# Usage: sync [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Update jail <jailname> or all
|
# Description: Update binaries and libraries
|
||||||
# Usage: update <jailname>|all
|
# Usage: update [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Upgrade chroot components for jail <jailname> or all
|
# Description: Upgrade configuration to new convention
|
||||||
# Usage: upgrade-config <jailname>|all
|
# Usage: upgrade-config [<jailname>|all]
|
||||||
#
|
#
|
||||||
|
|
||||||
# shellcheck source=./includes
|
# shellcheck source=./includes
|
||||||
|
|
|
@ -51,11 +51,10 @@ Options
|
||||||
Subcommands:
|
Subcommands:
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
for subcommand in ${LIBDIR}/bkctld-*; do
|
for filename in ${LIBDIR}/bkctld-*; do
|
||||||
name=$(basename "${subcommand}"|sed 's/^bkctld-//')
|
desc=$(grep -E "^# Description:" "${filename}"|sed "s/^# Description: //")
|
||||||
desc=$(grep -E "^#" "${subcommand}"|sed -n '3p'|sed "s/^# //")
|
usage=$(grep -E "^# Usage:" "${filename}"|sed "s/^# Usage: //")
|
||||||
usage=$(grep -E "^# Usage: ${name}" "${subcommand}"|sed "s/^# Usage: ${name}//")
|
printf " %- 32s %s\n" "${usage}" "${desc}"
|
||||||
printf " %- 15s %- 30s %- 40s\n" "${name}" "${usage}" "${desc}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
Loading…
Reference in a new issue