Hi all,
how to create multiple date log/file like one month create with touch command in Linux OS . if any one knows then could you please share the command .
How many files are you creating, and for what purpose? Do you want a file dated from one month ago? Use:
touch -d "$(date -d '1 month ago')" one-month-ago
for that. If you want 30 days worth of timestamped files, use something like:
for((day=0;day <= 30; day++)) do touch -d "$(date -d "$day days ago")" day-"$day" ;done
How many files are you creating, and for what purpose? Do you want a file dated from one month ago? Use:
touch -d "$(date -d '1 month ago')" one-month-ago
for that. If you want 30 days worth of timestamped files, use something like:
for((day=0;day <= 30; day++)) do touch -d "$(date -d "$day days ago")" day-"$day" ;done
Why would you even want to do this? It sounds like you're over thinking a few things.
Log rotate will automatically create them if setup with the correct parameters, compress and if possible restart the service if necessary.
A quick google search provided me with the link to RHEL6. If you want RHEL7, or others, a search will provide you with explicit steps:
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.