forked from ahurac/dotfiles
Correction : ré-écriture compacte de launch-minecraft-server
This commit is contained in:
parent
df173558a9
commit
6faa12608a
1 changed files with 4 additions and 18 deletions
|
@ -1,19 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh -ex
|
||||||
|
cd /srv/minecraft/bin
|
||||||
# Fonction pour afficher une erreur
|
PATH=".:${PATH}"
|
||||||
error() {
|
sudo -u minecraft screen "$1"
|
||||||
printf '\033[1;31m%s\033[0m \033[1m%s\033[0m\n' ERROR: "$1"
|
|
||||||
shift
|
|
||||||
exit "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Se déplacer dans le dossier des serveurs
|
|
||||||
cd /srv/minecraft/servers || exit
|
|
||||||
|
|
||||||
# Se déplacer dans le dossier demandé
|
|
||||||
test -d "${1}" || error "Le serveur \"${1}\" n'existe pas." "$?"
|
|
||||||
cd "${1}"
|
|
||||||
|
|
||||||
# Exécution
|
|
||||||
sudo -u minecraft screen ./start.sh
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue