[TASK] Migrate to systemctl service.

This commit is contained in:
Jan Philipp Timme 2016-10-30 16:10:31 +01:00
parent 72fc02b3c1
commit 4fd639f02e
4 changed files with 36 additions and 4 deletions

4
.gitignore vendored
View File

@ -1,3 +1,7 @@
venv/
settings.ini settings.ini
*.pyc *.pyc
*.cache *.cache
ftpbot.service

View File

@ -1,4 +0,0 @@
run:
python fdskun.py
install:
pip install -r requirements.txt

13
ftpbot.service.example Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=File system monitoring irc bot
After=network.target
[Service]
Type=simple
User=%USER%
Group=%GROUP%
ExecStart=%PWD%/venv/bin/python %PWD%/ftpbot.py
[Install]
WantedBy=multi-user.target

19
install.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# TODO: Make sure this is executed from within its original directory!
virtualenv ./venv
. ./venv/bin/activate
pip install -r requirements.txt
# Prepare a systemd service unit file with current pwd and user data
USER=`id -un`
GROUP=`id -gn`
PWD=`pwd`
cp ftpbot.service.example ftpbot.service
sed -i "s#%USER%#$USER#g" ftpbot.service
sed -i "s#%GROUP%#$GROUP#g" ftpbot.service
sed -i "s#%PWD%#$PWD#g" ftpbot.service
echo "Put ftpbot.servive within /etc/systemd/system and use systemctl to configure the service."