diff --git a/.gitignore b/.gitignore index 8c6f22a..884349f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +venv/ + settings.ini *.pyc *.cache + +ftpbot.service diff --git a/Makefile b/Makefile deleted file mode 100644 index ae3ddb7..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -run: - python fdskun.py -install: - pip install -r requirements.txt diff --git a/ftpbot.service.example b/ftpbot.service.example new file mode 100644 index 0000000..e6bc72e --- /dev/null +++ b/ftpbot.service.example @@ -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 + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..0073899 --- /dev/null +++ b/install.sh @@ -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."