Page 1 of 1

shell doubt

Posted: 2019/10/11 07:58:39
by knzzz
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
Regards
Kanna

Re: shell doubt

Posted: 2019/10/11 10:21:08
by tunk
Maybe setup something like this using a cron job or a systemd service:
#!/bin/bash
FILENAME=/full/path/to/abc_$(/usr/bin/date +"%y%m%d-%H%M").txt
/usr/bin/touch $FILENAME