Ajout : vérification si l'utilisation de la commande est valide dans les fonctions qui nécessitent un argument
This commit is contained in:
parent
cc3fa89c4d
commit
7106ed1658
1 changed files with 19 additions and 7 deletions
26
bin/mcserv
26
bin/mcserv
|
@ -25,21 +25,33 @@ error_usage() {
|
|||
}
|
||||
|
||||
public_start() {
|
||||
mcscreen -d -m -S "$1" \
|
||||
"/srv/minecraft/bin/${1}"
|
||||
if [ -n "$1" ]; then
|
||||
mcscreen -d -m -S "$1" \
|
||||
"/srv/minecraft/bin/${1}"
|
||||
else
|
||||
error_usage
|
||||
fi
|
||||
}
|
||||
|
||||
public_status() {
|
||||
printf '\033[1m%s\033[0m : ' "$1"
|
||||
if mcscreen -ls "$1" > /dev/null 2>&1; then
|
||||
echo "en cours d'exécution"
|
||||
if [ -n "$1" ]; then
|
||||
printf '\033[1m%s\033[0m : ' "$1"
|
||||
if mcscreen -ls "$1" > /dev/null 2>&1; then
|
||||
echo "en cours d'exécution"
|
||||
else
|
||||
echo "non en cours d'exécution"
|
||||
fi
|
||||
else
|
||||
echo "non en cours d'exécution"
|
||||
error_usage
|
||||
fi
|
||||
}
|
||||
|
||||
public_stop() {
|
||||
mcscreen -S "$1" -X stuff '^E^Ustop^M'
|
||||
if [ -n "$1" ]; then
|
||||
mcscreen -S "$1" -X stuff '^E^Ustop^M'
|
||||
else
|
||||
error_usage
|
||||
fi
|
||||
}
|
||||
|
||||
public_watch() {
|
||||
|
|
Loading…
Reference in a new issue