mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-20 15:20:16 +01:00
Update install_service.sh
Adding errorhandling due to wrong input characters
This commit is contained in:
parent
eacb72adea
commit
e86059a2f3
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Tiny script to install BOSWatch-service to use it via systemctl
|
||||
# Tiny script to install BOSWatch-service via systemctl
|
||||
# Just a few simple steps are required to (un)register your service
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
|
|
@ -13,9 +13,9 @@ read -p"Do you want to install (i) or remove (r) the service? " action
|
|||
if [ "$action" == "i" ]; then
|
||||
|
||||
# 1 Check whether the right data are in the service-file
|
||||
|
||||
|
||||
read -p"Did you adapt the file boswatch.service (y/n)? " response
|
||||
|
||||
|
||||
if [ "$response" == "y" ]; then
|
||||
# 2 Copy the file
|
||||
cp boswatch.service /etc/systemd/system
|
||||
|
|
@ -29,17 +29,23 @@ if [ "$action" == "i" ]; then
|
|||
|
||||
# 5 post the status
|
||||
systemctl status boswatch.service
|
||||
else
|
||||
elif [ "$response" == "n" ]; then
|
||||
echo "Please adapt your personal boswatch.service-file"
|
||||
exit 1
|
||||
else
|
||||
echo "Invalid input - please try again"
|
||||
exit 1
|
||||
fi
|
||||
else # we want to remove the service
|
||||
elif [ "$action" == "r" ]; then # we want to remove the service
|
||||
# stop it...
|
||||
systemctl stop boswatch.service
|
||||
|
||||
|
||||
# disable it
|
||||
systemctl disable boswatch.service
|
||||
|
||||
# and remove it
|
||||
rm /etc/systemd/system/boswatch.service
|
||||
else # error handling
|
||||
echo "Invalid input - please try again"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue