Files
SODEW/sodew-bash-main/libs/commands/help.sh
T
2026-08-18 09:40:08 +02:00

336 lines
11 KiB
Bash

function cmdHelpPrint() {
printf "%b" "\n$fontYellow $1$fontReset\n$2\n"
}
function cmdHelpK3S() {
local title="-k|--k3s <action>"
local desc="
create - create all resources in k3s
remove - remove all resources in k3s
info - detail about a k3s
status - status about a k3s
top - top pod
res [<resource>] - get resource info (all|pod|event|pv|pvc|deploy|ds|rs|sts|svc|ing|ip|secret|cm|job|cj|ep|no|ns|cs|netpol)"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpMariaDB() {
local title="-m|--mariadb <action>"
local desc="
install - install MariaDB in k3s
update - update MariaDB in k3s
uninstall - uninstall MariaDB from k3s
info - detail about a MariaDB
status - status about a MariaDB
replica - replica rebuild
database - database list
user - user list
dump [all|<database>] [<file>] - dump specified database or all databases from Master
dump_slave [<file>] - full dump from Slave"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpRedis() {
local title="-r|--redis <action>"
local desc="
install - install Redis in k3s
update - update Redis in k3s
uninstall - uninstall Redis from k3s
info - detail about a Redis
status - status about a Redis
user - user list
flush - flush current DB
pass - update default (root) pass"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpOpenLiteSpeed() {
local title="-o|--ols <action>"
local desc="
install - install OpenLiteSpeed in k3s
update - update OpenLiteSpeed in k3s
uninstall - uninstall OpenLiteSpeed from k3s
info - detail about a OpenLiteSpeed
list <option> - vhost list (all|up|down)
up - unpause vhost
down - pause vhost
alias - set aliases for domain
restart - restart OLS (graceful restart)
php_kill all|<domain> - kill lsphp for domain or all domains
white_list - WebAdmin white list update
allow_list - WebAdmin allow list update
alias_list all|<domain> - get aliases for domain or all domains
rebuild all|<domain> - rebuild owner and permission files
config - check config $olsConfigFile"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpPostfix() {
local title="-p|--postfix <action>"
local desc="
install - install Postfix in k3s
update - update Postfix in k3s
uninstall - uninstall Postfix from k3s
info - detail about a Postfix
status - status about a Postfix
user - user list (SASL)
dkim [<domain>] - autocreate and display DKIM key for DNS record or all domains !!!"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpWorker() {
local title="-w|--worker <action>"
local desc="
install - install Worker in k3s
update - update Worker in k3s
uninstall - uninstall Worker from k3s
list - task list
down - stop receiving new tasks from the API (pause)
up - start receiving new tasks from the API (unpause)
task <file> [<domain>] - Execute task !!!!!"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpMetric() {
local title="--metric <action>"
local desc="
install - install Metric in k3s
update - update Metric in k3s
uninstall - remove Metric from k3s
restart - restart !!!!"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpSite() {
local title="-s|--site <action>"
local desc="
add <domain> [<pathF>] [<pathD>] - add site (pathF: source files | pathD: source database)
add_wp|wp <domain> [<pathF>] [<pathD>] - add site on Wordpress
remove <domain> [-f|--force] - site full remove (-f|--force - forced mode)
copy <domain> <domainNew> - create copy of site
rename <domain> <domainNew> - rename of site
info <domain> - view site info and settings
status <domain> - check and verify site settings
rebuild <domain> - rebuild config for domain (in MariaDB, Redis, OLS, ...)
rebuild_wp <domain> - rewrite config connection to internal services in bootstrap.php
reset_pass all|<domain> - reset ALL passwords for domain or all domains
reset_auth all|<domain> - reset ALL authentication settings for domain or all domains
dump <domain> [<file>] - dump database of site"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpWP() {
local title="--wp <action>"
local desc="
user <domain> - user list
pass <domain> <user> <pass> - user password set
salt all|<domain> - shuffle salts
check all|<domain> - check core and plugins
exec all|<domain> <command> - command exec"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpSftp() {
local title="--sftp <action>"
local desc="
enable <domain> - enable sftp access
disable <domain> - disable sftp access
reset_pass <domain> - reset pass
user - list of users with SFTP access (group: $sftpAccessGroup)
support - adding support for SFTP access (group: $sftpAccessGroup)"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpCron() {
local title="--cron <action>"
local desc="
add - add jobs to cron
remove - remove jobs from cron
list - task list"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpBackup() {
local title="--backup <action>"
local desc="
run all|<domain> [<path>] [<type>] - backup
path: path to save backup, default: autogenerate
type: type backup (zip|tar|archive|rsync), default: $backupType
list - list backups on local
size - list of backup sizes"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpRestore() {
local title="--restore <domain> $fontRed[NO TESTED!]$fornReset"
local desc="
run <domain> [<option>] - manual site restore
<empty> - manual site restore
list - display a list of available markers for restore
last - automatic site restore from the last backup
full - automatic site restore from the last FULL backup
auto - automatic site restore from the last FULL backup or the last backup
N - automatic site restore from the last backup #N (N: 1+)"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpStorage() {
local title="--storage [option]"
local desc="
list - list backups on external storage
compare - comparison table
size - list of backup sizes
sync <type> - synchronization with external storage (archive|daily)
remove - remove backups on external storage"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpScript() {
local title="--script <action>"
local desc="
backup - creating a backup all sites and then synchronizing with external storage
backup-long-term - creating long-term backups
backup-clean - cleanup of old backups on the current host and on external storage
mariadb-dump - creating a backup of all databases in MariaDB
worker-observer - launching the task observer
metric-kube - send kube metrics to API (Grafana)
metric-sites - send sites metrics to API
diag-report-ai-short - send diag short report to AI
diag-report-ai-full - send diag full report to AI"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpTest() {
local title="--test <action> $fontRed[NO TESTED!]$fornReset"
local desc="
mariadb - test MariaDB replica
redis - test Redis cluster
site - test create default site
wordpress - test create Wordpress site"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpMalware() {
local title="--malware <action>"
local desc="
check - check malware in all vhosts
remove - remove malware in all vhosts"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpShell() {
local title="--shell [cli]"
local desc="
opening the shell or cli (if any) in the pods"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpLog() {
local title="--log [parameters]"
local desc="
opening the logs in the pods. Standard kubectl parameters for logs can be added, for example:
-f: logs should be streamed
--previous: print the logs for the previous instance of the container in a pod if it exists"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpDescribe() {
local title="--describe <option>"
local desc="
pod - describe pods
node - describe node"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpDelete() {
local title="--delete"
local desc="
delete pods"
cmdHelpPrint "$title" "$desc"
}
function cmdHelpInstall() {
local title="--install"
local desc="
install full infrastructure (apk, update ipset/iptables, install k3s, apply yaml...)"
cmdHelpPrint "$title" "$desc"
}
function cmdHelp() {
local title="$appName"
local desc="
Usage: $0 [arguments...]"
cmdHelpPrint "$title" "$desc"
printDotFix 20 "$fontBlue -k|--k3s" "Commands for k3s"
printDotFix 20 "$fontBlue -m|--mariadb" "Commands for MariaDB"
printDotFix 20 "$fontBlue -r|--redis" "Commands for Redis"
printDotFix 20 "$fontBlue -o|--ols" "Commands for Openlitespeed"
printDotFix 20 "$fontBlue -p|--postfix" "Commands for Postfix"
printDotFix 20 "$fontBlue -w|--worker" "Commands for Worker (agent)"
printDotFix 20 "$fontBlue -s|--site" "Commands for Sites"
printDotFix 20 "$fontBlue --metric" "Commands for Metrics"
printDotFix 20 "$fontBlue --wp" "Commands for Wordpress"
printDotFix 20 "$fontBlue --sftp" "Commands for SFTP"
printDotFix 20 "$fontBlue --cron" "Commands for Cron"
printDotFix 20 "$fontBlue --shell" "Shell or cli (if any) in pods"
printDotFix 20 "$fontBlue --log" "Log of pods"
printDotFix 20 "$fontBlue --describe" "Describe of pods"
printDotFix 20 "$fontBlue --delete" "Delete pods"
printDotFix 20 "$fontBlue --backup" "Create backup of sites"
printDotFix 20 "$fontBlue --restore" "Restore sites from backups"
printDotFix 20 "$fontBlue --storage" "Copy backups to storage"
printDotFix 20 "$fontBlue --script" "Execute scripts"
printDotFix 20 "$fontBlue --install" "Install full infrastructure"
printDotFix 20 "$fontBlue --test" "Testing infrastructure"
printDotFix 20 "$fontBlue --malware" "Malware search"
printDotFix 20 "$fontBlue --help" "This help"
printRow
cmdHelpK3S
cmdHelpMariaDB
cmdHelpRedis
cmdHelpOpenLiteSpeed
cmdHelpPostfix
cmdHelpWorker
cmdHelpSite
cmdHelpMetric
cmdHelpWP
cmdHelpSftp
cmdHelpCron
cmdHelpShell
cmdHelpLog
cmdHelpDescribe
cmdHelpDelete
cmdHelpBackup
cmdHelpRestore
cmdHelpStorage
cmdHelpScript
cmdHelpInstall
cmdHelpTest
cmdHelpMalware
}