[TASK] Migrate to systemctl service.
This commit is contained in:
parent
72fc02b3c1
commit
4fd639f02e
|
@ -1,3 +1,7 @@
|
||||||
|
venv/
|
||||||
|
|
||||||
settings.ini
|
settings.ini
|
||||||
*.pyc
|
*.pyc
|
||||||
*.cache
|
*.cache
|
||||||
|
|
||||||
|
ftpbot.service
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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."
|
Loading…
Reference in New Issue