Changeset View
Changeset View
Standalone View
Standalone View
scripts/comm-dev.sh
Show All 10 Lines | log() { | ||||
echo "$@" >&2 | echo "$@" >&2 | ||||
} | } | ||||
usage() { | usage() { | ||||
echo "Comm Development" | echo "Comm Development" | ||||
echo "" | echo "" | ||||
echo "Commands:" | echo "Commands:" | ||||
echo " services - start or stop development services" | echo " services - start or stop development services" | ||||
echo " db - restart MariaDB server" | |||||
echo "" | echo "" | ||||
exit 1 | exit 1 | ||||
} | } | ||||
services_usage() { | services_usage() { | ||||
echo "Comm Development Services" | echo "Comm Development Services" | ||||
echo "" | echo "" | ||||
Show All 24 Lines | case "$1" in | ||||
*) | *) | ||||
log "$(basename "$0"): unknown services option '$1'" | log "$(basename "$0"): unknown services option '$1'" | ||||
services_usage | services_usage | ||||
exit 1 | exit 1 | ||||
;; | ;; | ||||
esac | esac | ||||
} | } | ||||
db_usage() { | |||||
echo "Comm MariaDB Server" | |||||
echo "" | |||||
echo "Commands:" | |||||
echo " restart - restart MariaDB server" | |||||
echo "" | |||||
exit 1 | |||||
} | |||||
db_command() { | |||||
case "$1" in | |||||
restart) | |||||
pkill mariadbd | |||||
nix run .#mariadb-up | |||||
;; | |||||
*) | |||||
log "$(basename "$0"): unknown db option '$1'" | |||||
db_usage | |||||
exit 1 | |||||
;; | |||||
esac | |||||
} | |||||
case "$1" in | case "$1" in | ||||
-h|--help) | -h|--help) | ||||
usage | usage | ||||
;; | ;; | ||||
services) | services) | ||||
shift | shift | ||||
services_command "$@" | services_command "$@" | ||||
;; | ;; | ||||
db) | |||||
shift | |||||
db_command "$@" | |||||
;; | |||||
*) | *) | ||||
log "$(basename "$0"): unknown option '$1'" | log "$(basename "$0"): unknown option '$1'" | ||||
usage | usage | ||||
;; | ;; | ||||
esac | esac |