logrotate does not work!
I added a file with the following content to /etc/logrotate.d:
/var/log/ocmpproxy.log {
daily
missingok
rotate 4
postrotate
touch /root/test.txt
kill -USR2 `ps aux | grep java | grep OcmpProxy | sed 's/\([a-z]*\) *\([0-9]*\) .*/\2/'`
endscript
}
When I run logrotate, (logrotate -d -f logrotate.conf), my process does not receive any signal. Even the /root/test.txt is not created!
If I run "/bin/kill -USR2 `ps aux | grep java | grep OcmpProxy | sed 's/\([a-z]*\) *\([0-9]*\) .*/\2/'`" from the command line my process receives the signal without any problem.
I am new to logrotate. I appreciate any help.
Is that wrong to call shell command in logrotate?
Thanks in advance.
|