From 1e68c6dec5b07670441ddea1f83732fa8f19995f Mon Sep 17 00:00:00 2001 From: st33v Date: Tue, 23 Feb 2016 18:03:53 +1100 Subject: First commit. Basic working state but not very smart yet --- takepix.service | 12 ++++++++++++ takepix.sh | 6 ++++++ takepix.timer | 12 ++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 takepix.service create mode 100755 takepix.sh create mode 100644 takepix.timer diff --git a/takepix.service b/takepix.service new file mode 100644 index 0000000..d7e73b5 --- /dev/null +++ b/takepix.service @@ -0,0 +1,12 @@ +[Unit] +Description=Take a photo and store it ready for uplift to STAN + +[Service] +Type=oneshot +User=st33v +# need double quotes to evaluate contents of variable +# Environment="picdate=date +%Y-%m-%d_%H%M" +WorkingDirectory=/home/st33v/pix/ +# ExecStart=/bin/echo +# ExecStart=/opt/vc/bin/raspistill -o /home/st33v/pix/$(eval "echo $(picdate)").jpg +ExecStart=/usr/local/bin/takepix.sh diff --git a/takepix.sh b/takepix.sh new file mode 100755 index 0000000..63f3082 --- /dev/null +++ b/takepix.sh @@ -0,0 +1,6 @@ +#!/bin/bash + + +picdate=$(date +%Y-%m-%d_%H%M) +/opt/vc/bin/raspistill -x IFD1.Artist=neatherd -o /home/st33v/pix/${picdate}.jpg + diff --git a/takepix.timer b/takepix.timer new file mode 100644 index 0000000..1dda309 --- /dev/null +++ b/takepix.timer @@ -0,0 +1,12 @@ +[Unit] +Description= Take a photo each half hour + +[Timer] +Persistent=true +OnBootSec=1min +#OnCalendar=30m +OnUnitActiveSec=30m +Unit=takepix.service + +[Install] +WantedBy=timers.target -- cgit v1.3