Mac OS Desktop Screenshot Command
#!/bin/bash
i="0"
sleep_time=$1
time_start=$2
time_end=$3
if [ -z "$sleep_time" ] || [ -z "$time_start" ] || [ -z "$time_end" ]; then
echo "Make sure the options are all entered! Thanks! :)"
exit
fi
while [ $i -lt 1 ]
do
DATE=`date +%d-%h-%y--%H-%M-%S--%A`
YEAR=`date +%Y`
MONTH=`date +%h`
DAY=`date +%d`
HOURS=`date +%H`
MINUTES=`date +%M`
TIME="$HOURS$MINUTES"
TIME=${TIME#0}
if [ ! -d "$YEAR/$MONTH/$DAY" ]; then
mkdir -p $YEAR/$MONTH/$DAY
fi
if [ "$TIME" -gt "$time_start" ] && [ "$TIME" -lt "$time_end" ]; then
screencapture -x a.png b.png && convert -resize 66% +append b.png a.png $YEAR/$MONTH/$DAY/productivity-watcher--${DATE}.jpg
sleep $sleep_time
else
echo "Not in the right time! Waiting 5 minutes! Time is $TIME"
sleep 300
fi
done