added a python script to take a picture, plus service and timer for running it daily

This commit is contained in:
Shoofle 2022-02-10 16:02:18 -05:00
parent 5b59cade63
commit e2eac258d7
4 changed files with 29 additions and 1 deletions

7
take_a_still.py Normal file
View File

@ -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))

11
telescopium.service Normal file
View File

@ -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

10
telescopium.timer Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Timer for taking a daily picture
[Timer]
OnCalendar=daily
AccuracySec=1m
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -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; } 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/