logrotate script cause "Read-only file system" error while writing logs in /etc/ directory
Issue
-
logrotate
postrotate script cause "Read only filesystem" error while writing logs in/etc/
directory, but same script works in RHEL 8, and it runs well in RHEL 9 with interactive execution./var/log/myservice/*.log { weekly rotate 7 ... postrotate sh /etc/myservice/myscript.sh <<==== this script output logs to /etc/myservice/log/*.log, and it fails with `Read-only file system` endscript }
Log example:
Aug 22 00:01:07 myrhel9 logrotate[33408]: /etc/myservice/myscript.sh: line 4: /etc/myservice/log/myservice.log: Read only filesystem
Environment
- Red Hat Enterprise Linux 9
- logrotate
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.