mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-21 06:13:39 +00:00
Installscript for service
A tiny to script to install and register the service automatically There is also a possibility to remove the service
This commit is contained in:
parent
625d6b643e
commit
d248a7d45d
1 changed files with 45 additions and 0 deletions
45
service/install_service.sh
Normal file
45
service/install_service.sh
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Tiny script to install BOSWatch-service to use it via systemctl
|
||||||
|
# Just a few simple steps are required to (un)register your service
|
||||||
|
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "This script must be run as root!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# 3 Enable the service and check status
|
||||||
|
systemctl enable boswatch.service
|
||||||
|
systemctl is-enabled boswatch.service
|
||||||
|
|
||||||
|
# 4 fire it up
|
||||||
|
systemctl start boswatch.service
|
||||||
|
|
||||||
|
# 5 post the status
|
||||||
|
systemctl status boswatch.service
|
||||||
|
else
|
||||||
|
echo "Please adapt your personal boswatch.service-file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else # 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
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue