From 503acdd23b2eec494684b891c26f6da776831e4d Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Wed, 23 Jun 2021 09:20:33 +0200 Subject: [PATCH] solution --- script.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 script.sh diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..3946e93 --- /dev/null +++ b/script.sh @@ -0,0 +1,24 @@ +#! /bin/bash + +set -eu + +test $# -ne 2 && { echo "Usage: $0 start|stop|restart service" ; exit 42 ; } + +case $1 in + (start) + echo "starting $2" + ;; + (stop) + echo "stopping $2" + ;; + (restart) +# ne marche que si le script est exécutable + $0 stop $2 + $0 start $2 + ;; + (*) + echo "action inconnue" + exit 1 + ;; +esac +