mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2025-05-24 19:14:39 +02:00
cron/webcam*: added systemd-files & made script more readable
This commit is contained in:
parent
e3363f1f4c
commit
71298adbeb
4 changed files with 25 additions and 7 deletions
4
cron/webcam-install.sh
Executable file
4
cron/webcam-install.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
cp webcam.service webcam.timer ~/.config/systemd/user/
|
||||
systemctl enable webcam.timer --user
|
6
cron/webcam.service
Normal file
6
cron/webcam.service
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Unit]
|
||||
Description=Webcam script
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/felix/.dotfiles/cron/webcam.sh
|
||||
Type=oneshot
|
|
@ -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
|
||||
|
|
9
cron/webcam.timer
Normal file
9
cron/webcam.timer
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=1hour webcam-timer
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*:0
|
||||
Unit=webcam.target
|
||||
|
||||
[Install]
|
||||
WantedBy=webcam.target
|
Loading…
Add table
Add a link
Reference in a new issue