From c24ce7f2d921c722370ed17de6398b492d1a2713 Mon Sep 17 00:00:00 2001 From: fram3d Date: Thu, 13 Jul 2023 18:28:16 +0200 Subject: [PATCH] add crontab scripts to build-deb and fix CONFIG_PATH in donationconfig.py --- build-deb/donationcalc/DEBIAN/postinst | 7 +++++++ build-deb/donationcalc/DEBIAN/prerm | 7 +++++++ donationcalc/donationconfig.py | 3 +-- requirments.txt | 1 - 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 build-deb/donationcalc/DEBIAN/postinst create mode 100644 build-deb/donationcalc/DEBIAN/prerm diff --git a/build-deb/donationcalc/DEBIAN/postinst b/build-deb/donationcalc/DEBIAN/postinst new file mode 100644 index 0000000..97c33ce --- /dev/null +++ b/build-deb/donationcalc/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh + +/usr/bin/echo "Adding monthly rebalance to crontab" +/usr/bin/crontab -l > /tmp/donationcalccrontab.tmp +/usr/bin/echo "0 0 1 * * /usr/bin/python3 /var/donationcalc/run.py -r" >> /tmp/donationcalccrontab.tmp +/usr/bin/crontab /tmp/donationcalccrontab.tmp +/usr/bin/rm /tmp/donationcalccrontab.tmp diff --git a/build-deb/donationcalc/DEBIAN/prerm b/build-deb/donationcalc/DEBIAN/prerm new file mode 100644 index 0000000..5644be7 --- /dev/null +++ b/build-deb/donationcalc/DEBIAN/prerm @@ -0,0 +1,7 @@ +#!/bin/sh + +/usr/bin/echo "Removing monthly rebalance to crontab" +/usr/bin/crontab -l > /tmp/donationcalccrontab.tmp +/usr/bin/grep -v "0 0 1 * * /usr/bin/python3 /var/donationcalc/run.py -r" /tmp/donationcalccrontab.tmp >> /tmp/donationcalccrontab.tmp1 +/usr/bin/crontab /tmp/donationcalccrontab.tmp1 +/usr/bin/rm /tmp/donationcalccrontab.tmp /tmp/donationcalccrontab.tmp1 diff --git a/donationcalc/donationconfig.py b/donationcalc/donationconfig.py index 8e49f15..99b633d 100644 --- a/donationcalc/donationconfig.py +++ b/donationcalc/donationconfig.py @@ -1,8 +1,7 @@ import configparser class donationconfig(): - #CONFIG_PATH = "/var/donationcalc/donationcalc/config.ini" - CONFIG_PATH = "/home/anon/src/donationcalc/donationcalc/config.ini" + CONFIG_PATH = "/var/donationcalc/donationcalc/config.ini" config = configparser.ConfigParser() config.read(CONFIG_PATH) diff --git a/requirments.txt b/requirments.txt index 7acfc7f..7e10602 100644 --- a/requirments.txt +++ b/requirments.txt @@ -1,2 +1 @@ flask -schedule