add systemd service generation script (service.sh)

This commit is contained in:
anonymous
2019-12-07 14:55:07 +00:00
parent 5b8dc33e9c
commit 67ff2d9666

24
service.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Generate systemd service file
FILE=/lib/systemd/system/buttond.service
generate() {
echo [Unit]
echo Description = buttonctl
echo
echo [Service]
echo ExecStart = /usr/bin/python3 $PWD/button.py
echo Type = simple
echo
echo [Install]
echo WantedBy=multi-user.target
echo Alias=buttond.service
}
if test -f $FILE
then
rm $FILE
fi
touch $FILE
generate >> $FILE