shell doubt

General support questions
Post Reply
Posts: 144
Joined: 2017/02/25 12:41:42

shell doubt

Post by knzzz » 2019/10/11 07:58:39

How to touch a file exactly at specific time daily by taking its current date along in the file

For eg:

abc_dd-mm-yy.txt file need to be created daily in case if the system rebooted or shutdown once it is up it should create the file
if one file is already there another file should not get created

Posts: 698
Joined: 2017/02/22 15:08:17

Re: shell doubt

Post by tunk » 2019/10/11 10:21:08

Maybe setup something like this using a cron job or a systemd service:
FILENAME=/full/path/to/abc_$(/usr/bin/date +"%y%m%d-%H%M").txt
/usr/bin/touch $FILENAME

Post Reply

Return to “CentOS 7 - General Support”