Hello I wrote a simple command line script which is suppose to take my screenshot every 5 minutes.
(using ImageMagick's "import" program)
here is the script (shottr.sh):
#!/bin/sh
PTH="/home/username/images"
NM=`date +%j`_`date +"%F %k:%M"`
/usr/bin/import -window root -resize 1024 "$PTH/$NM.png" &
echo "Screenshot" | festival --tts &
this is working fine if I execute by hand i.e:
# ./shottr.sh
or
#sh shottr.sh
the cron is set like this:
*/5 * * * * /bin/sh /home/username/scripts/shottr.sh
the script itself is being executed (I hear a voice saying: "Screenshot") but the actual screenshot is not taken.
P.S: Be assured that it is NOT permission issue (I placed a simple "touch" invocation and file was created)
may be if it's run from cron...it doesn't have a "window" so it can't take a screenshot from nowhere?? If that is the case, then how can I workaround it?
NM=$(date "+%j_%F %k:%M")
(no need to rundate
twice). Putting the Julian day number first ruins the sortability of the filenames and you might want to consider not including a space.