efflandt@raspbian ~ $ echo "/home/pi/$( /bin/date '+%H-%M-%S' ).jpg"
The problem is that cron interprets anything after % to be input to whatever is before that, and not sure how to escape that. So since cron cannot properly interpret your date parameters, it would be better use a short script. Create a bin
directory in your home directory, which will automatically be in your $PATH the next time you login, so it is a good place to put personal scripts or binaries. In your ~/bin
, create a short script called touchme
and then give it execute permission with chmod ug+x touchme
Code: Select all
/usr/bin/touch "/home/pi/$( /bin/date '+%H-%M-%S' ).jpg"
But you may want to make a subdirectory and extend the path into that, so all those files do not jam up your home directory. Then all you need in crontab -e
Works for me, but note that seconds
will probably never change, since cron is run once per minute maximum, so seconds may be redundant information.