forked from NOAA-OWP/ngencerf-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogrotate-ngencerf-cron.prod
More file actions
33 lines (32 loc) · 1.38 KB
/
logrotate-ngencerf-cron.prod
File metadata and controls
33 lines (32 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Sample cron job for rotating ngencerf logs (production)
#
# NOTE: This file is a **sample only**. It is NOT installed directly.
# The production deployment script writes the actual cron entry to:
#
# /etc/cron.d/ngencerf-logrotate
#
# Because the real job lives in /etc/cron.d, the cron line must follow
# the /etc/cron.d format:
#
# <schedule> <user> <command>
#
# The production logrotate configuration file is:
# /ngencerf-app/ngencerf-server/logrotate-ngencerf.prod.conf
#
# This config file **must**:
# - be owned by root:root
# - not be group- or world-writable (chmod 644)
#
# These are required by logrotate:
# sudo chown root:root /ngencerf-app/ngencerf-server/logrotate-ngencerf.prod.conf
# sudo chmod 644 /ngencerf-app/ngencerf-server/logrotate-ngencerf.prod.conf
#
# Behavior of the installed cron job:
# - runs twice daily at 10:00 and 22:00 UTC
# - does NOT force rotation (-f is intentionally omitted)
# - rotation occurs only when logrotate’s conditions are met (e.g. daily, minsize)
# - uses copytruncate to remain compatible with Django logging.FileHandler
# - avoids USR1 signaling and cross-namespace process coordination
#
# The cron command only runs if the config file exists.
0 10,22 * * * root [ -f /ngencerf-app/ngencerf-server/logrotate-ngencerf.prod.conf ] && /usr/sbin/logrotate /ngencerf-app/ngencerf-server/logrotate-ngencerf.prod.conf