diff --git a/cron/webcam-install.sh b/cron/webcam-install.sh new file mode 100755 index 0000000..573d7a2 --- /dev/null +++ b/cron/webcam-install.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cp webcam.service webcam.timer ~/.config/systemd/user/ +systemctl enable webcam.timer --user diff --git a/cron/webcam.service b/cron/webcam.service new file mode 100644 index 0000000..450021e --- /dev/null +++ b/cron/webcam.service @@ -0,0 +1,6 @@ +[Unit] +Description=Webcam script + +[Service] +ExecStart=/home/felix/.dotfiles/cron/webcam.sh +Type=oneshot diff --git a/cron/webcam.sh b/cron/webcam.sh index b913de0..95564b8 100755 --- a/cron/webcam.sh +++ b/cron/webcam.sh @@ -1,15 +1,14 @@ #!/bin/bash -## 0 * * * * cd ~/.dotfiles/cron/ && bash webcam.sh +## 0 * * * * ~/.dotfiles/cron/webcam.sh now=$(date +"%Y_%m_%d_%H_%M_%S") -path="$HOME/Pictures/hour-pics/" +path="$HOME/Pictures/hour-pics" size="1280x720" +basename=$(dirname $(readlink -f $0)) mkdir -p $path -streamer -q -f jpeg -s $size -o $path$now.jpeg -r 1 -grey="$(python3 $(dirname $(readlink -f $0))/blackcheck.py -i $path$now.jpeg -d 10)" -# echo $grey +streamer -q -f jpeg -s $size -o $path/$now.jpeg -r 1 +grey="$(python3 $basename/blackcheck.py -i $path/$now.jpeg -d 10)" if [ "$grey" = "True" ] ; then - # echo "Has to move" - mv $path$now.jpeg ${path}black/$now.jpeg + mv $path/$now.jpeg $path/black/$now.jpeg fi exit 0 diff --git a/cron/webcam.timer b/cron/webcam.timer new file mode 100644 index 0000000..d7315b6 --- /dev/null +++ b/cron/webcam.timer @@ -0,0 +1,9 @@ +[Unit] +Description=1hour webcam-timer + +[Timer] +OnCalendar=*:0 +Unit=webcam.target + +[Install] +WantedBy=webcam.target