Operating System - HP-UX
1753785 Members
7633 Online
108799 Solutions
New Discussion

Generate file name through crontab

 
richard_kouadio
Advisor

Generate file name through crontab

Hi expert,
I want to generate a file through crontab file according to the date.
the command I used in the crontab file is the following : last -R > /"monitor_$(date +%d%y%M)"
As you can see I try to put the result of last -R in files called monitor_ and ended by the date.
When I used the command the line above at prompt, the different files are created.
But when I put the command line above in the crontab file, only one file named monitor_ was created. Are they a way to solve this issue.

THx for your help.
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Generate file name through crontab

If you look at crontab(1) carefully, you'll see that "%" is special and needs to be quoted with "\".