[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[atomic-devel] cron job for logrotate on containers



I have a script which would run logrotate on all running docker containers.
Plan is to have this installed via the docker rpm into /etc/cron.daily. Posting here 
for further discussion as per Colin's suggestion before I include it in any rpms.

---
#!/bin/sh

for id in $(docker ps -q); do
    docker exec $id logrotate -s /var/log/logstatus /etc/logrotate.conf >/dev/null 2>&1
done
exit 0
---

Of course this assumes that logrotate is installed on the containers and will ignore any failures

Comments/questions?
-- 
Lokesh
Freenode, OFTC: lsm5
GPG: 0xC7C3A0DD

Attachment: pgpJyDdEtWzym.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]