Skip to content

Commit

Permalink
Merge pull request #316 from Schrolli91/flothi-patch-1
Browse files Browse the repository at this point in the history
Adaptations for "new" service
  • Loading branch information
Schrolli91 authored Oct 3, 2017
2 parents e503130 + e86059a commit cfcc12b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### __[v2.2.2]__ - unreleased
##### Added
- Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316)
##### Changed
- Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315)
- Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c)
Expand Down
12 changes: 8 additions & 4 deletions service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ We assume that BOSWatch is installed to /opt/boswatch! Otherwise you need to ada
Enter the frequency and the decoder(s) you want to use in line 7; you can add more specific switches if you need to

### Install the service
1. Copy the file to /lib/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /lib/systemd/system/
2. Change the rights: sudo chmod 644 /lib/systemd/system/boswatch.service
3. Enable the service: sudo systemctl enable boswatch.service
4. Start the service: sudo systemctl start boswatch.service
1. Use the install-script install_service.sh as sudo: `sudo bash install_service.sh` (self explaining)

OR

1. Copy the file to /etc/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /etc/systemd/system/
2. Enable the service: sudo systemctl enable boswatch.service
3. Start the service: sudo systemctl start boswatch.service
4. Check the status: sudo systemctl status boswatch.service

---

Expand Down
51 changes: 51 additions & 0 deletions service/install_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# 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
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
elif [ "$response" == "n" ]; then
echo "Please adapt your personal boswatch.service-file"
exit 1
else
echo "Invalid input - please try again"
exit 1
fi
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

0 comments on commit cfcc12b

Please sign in to comment.