Logrotate is showing different results when running with cron job and manually

24 Views Asked by At

Path of my conf file: /home/my_home/config_files/ my conf file:

/home/my_home/zookeeper/zookeeper-node-*.out {
    rotate 15
    size 1K
    su me me
    olddir /home/my_home/logs/zookeeper
    createolddir 0775 carbon carbon
    copytruncate
    compress
    maxage 7
    missingok
}
  1. When I run this job manually "logrotate nohup_zk.conf" while i logged in as carbon user , it is working fine as expected.
  2. But when I run this job using cron "*/1 * * * * carbon run-parts /home/my_home/config_files/" , I am getting an error saying permission denied to create /home/my_home/logs directory.

Note: In cofig_files i have a script which uses logrotate command and executes the conf file in other directory

But when I run it manually it created the logs directory and the rotated log file as well

0

There are 0 best solutions below