Grimoire-
Command
.es

GNU+Linux command memo

Using logrotate with a simple user

Utiliser logrotate sans avoir les droits d’admin (de l’utilisateur root).

1. Create a configuration directory

$ mkdir ~/.logrotate

2. Put a logrotate configuration file in it

$ vi ~/.logrotate/my.conf  (1) (2)
1 man logrotate for examples of configuration files
2 You can (and should) check your configuration file with : logrotate -d ~/.logrotate/my.conf

3. Have crontab running your logrotate conf.

$ crontab -e
30 2 * * * /usr/sbin/logrotate -s /home/$the_user/.logrotate/status /home/$the_user/.logrotate/my.conf > /dev/null 2>&1  (1) (2)
1 Add this cron job definition line to your crontab
2 Beware to replace $the_user by the actual user login