From bb258450bc10ceea7b64862d36ed5fb948715c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Wed, 12 Feb 2020 20:23:27 +0100 Subject: [PATCH 1/2] change today variable --- workdirfs.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/workdirfs.py b/workdirfs.py index 9f885ac..381539f 100755 --- a/workdirfs.py +++ b/workdirfs.py @@ -26,26 +26,30 @@ except: class WorkdirFS(Operations): def __init__(self, args): self.args = args + self.today = datetime.now() - timedelta(hours=self.args.timeoffset) # Helpers # ======= def _full_path(self, partial): - today = datetime.now() - timedelta(hours=self.args.timeoffset) + self.today = datetime.now() - timedelta(hours=self.args.timeoffset) if self.args.yearlydir: - path = os.path.join(os.environ['HOME'], self.args.archive,"workdir",today.strftime("%Y")) + path = os.path.join(os.environ['HOME'], + self.args.archive,"workdir",self.today.strftime("%Y")) if self.args.monthlydir: - path = os.path.join(path, today.strftime("%m")) + path = os.path.join(path, self.today.strftime("%m")) else: path = os.path.join(os.environ['HOME'], self.args.archive, "workdir") if partial.startswith("/"): partial = partial[1:] - path = os.path.join(check_dir(os.path.join(path, today.strftime("%Y-%m-%d"))), partial) + path = os.path.join(check_dir(os.path.join(path, self.today.strftime("%Y-%m-%d"))), partial) return path + def _full_content_path(self, partial): + # Filesystem methods # ================== From 8de02a391e6d87b0ad8cb7e0b680960387329329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Wed, 12 Feb 2020 20:23:50 +0100 Subject: [PATCH 2/2] Use Environment for Mountpoint to umount --- workdirfs.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workdirfs.service b/workdirfs.service index 5f741b6..832ad6f 100644 --- a/workdirfs.service +++ b/workdirfs.service @@ -2,5 +2,6 @@ Description=Daily working directory ~/Work [Service] -ExecStart=/usr/bin/python3 -u /usr/local/bin/workdirfs.py +Environment=MOUNTPOINT=%h/Work +ExecStart=/usr/bin/python3 -u /usr/local/bin/workdirfs.py -m $MOUNTPOINT ExecStop=/usr/bin/fusermount -u ${MOUNTPOINT}