[QUOTE=ab;28864]On 07/24/2015 12:54 AM, Santosh 2411 wrote:[color=blue]
I have to Rotate one of my log file (test_cron.log) which is under
/root/ on daily basis , so for that i have made one new file in under
also added entry in crontab as : */1 * * * * /usr/sbin/logrotate
But it does not rotate daily.
and write code as follows.
create 0600 root root
Is the size of the to-be-rotated file at least 20k, as you have defined as
a requirement above? If not, no rotation will happen unless you add
What happens if you call the command directly and add the --verbose switch
so you can see evaluation as it happens? Post back here and we should be
able to help analyze it.
Also, your cron entry is redundant; */1 is the same as *, so just go with
- unless you have a great reason to do otherwise. Also, be sure your cron
job is running as ‘root’; if you are properly using ‘crontab -e’ to setup
the crontab entry, and are doing so as a non-root user, then that would
impact this of course since a non-root user’s cron job would not have
rights to do anything in /root by default.
Finally, you should probably setup this logrotate definition under
/etc/logrotate.d along with other files. This way you do not need a
separate cron job. If you really want its own call via cron, then put
your cron definition under /etc/cron.daily instead, rather than having
your own cron job setup.
Also i want 7 days backup of that log file and if file size increased by
say for example 20k then also it must be make new file with date
Thanks in advance…
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…[/QUOTE]
as per your suggestion, its working now…