From e2eac258d786c5093c869be6a510ee66bcca1af6 Mon Sep 17 00:00:00 2001 From: Shoofle Date: Thu, 10 Feb 2022 16:02:18 -0500 Subject: [PATCH] added a python script to take a picture, plus service and timer for running it daily --- take_a_still.py | 7 +++++++ telescopium.service | 11 +++++++++++ telescopium.timer | 10 ++++++++++ telescopium_work_log | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 take_a_still.py create mode 100644 telescopium.service create mode 100644 telescopium.timer diff --git a/take_a_still.py b/take_a_still.py new file mode 100644 index 0000000..d61c4da --- /dev/null +++ b/take_a_still.py @@ -0,0 +1,7 @@ +#!/bin/python3 +import os +import subprocess + +filename = os.popen("date +%+4Y-%m-%d-%Hh%Mm.jpg").read() + +os.system("libcamera-jpeg -o /var/www/html/stills/{}".format(filename)) diff --git a/telescopium.service b/telescopium.service new file mode 100644 index 0000000..e4e6968 --- /dev/null +++ b/telescopium.service @@ -0,0 +1,11 @@ +[Unit] +Description=take a picture every day + +[Service] +Type=oneshot +WorkingDirectory = /home/shoofle/telescopium +ExecStart=python /home/shoofle/telescopium/take_a_still.py +User=shoofle + +[Install] +WantedBy=multi-user.target diff --git a/telescopium.timer b/telescopium.timer new file mode 100644 index 0000000..0765894 --- /dev/null +++ b/telescopium.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Timer for taking a daily picture + +[Timer] +OnCalendar=daily +AccuracySec=1m +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/telescopium_work_log b/telescopium_work_log index 13ff795..d91e970 100644 --- a/telescopium_work_log +++ b/telescopium_work_log @@ -16,4 +16,4 @@ command for outputting a datetime filename: date +%+4Y-%m-%d-%Hh%Mm.jpg added a listing for autoindexing the folder /var/www/html/stills/ with location /stills/ { autoindex: on; } - +made a python script to take a picture, plus a systemd service and timer to take pictures daily! they need to be symlinked into /etc/systemd/system/