Skip to content

Commit

Permalink
add logrotate sample
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhotio committed Aug 19, 2023
1 parent b4bb893 commit 0d86f70
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion root/app/fail2ban/jail.d/caddy-4xx.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[caddy-4xx]
enabled = true
enabled = false
port = 8080,8443
logpath = /config/logs/access.log
banTime = 3600
Expand Down
2 changes: 1 addition & 1 deletion root/app/fail2ban/jail.d/jellyfin.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[jellyfin]
enabled = false
port = 8080,8443
logpath = /jellyfin/log_*.log
logpath = /jellyfin/current.log
banTime = 3600
findTime = 600
maxretry = 3
12 changes: 12 additions & 0 deletions root/app/logrotate/jellyfin
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/jellyfin/*.log {
rotate 12
daily
compress
missingok
notifempty
postrotate
nfn="/jellyfin/log_$(date +%Y%m%d).log"
touch "$nfn"
ln -fs "$nfn" /jellyfin/current.log
chown -R hotio:hotio /jellyfin
}
17 changes: 17 additions & 0 deletions root/etc/cont-init.d/01-config-app
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,20 @@ if [[ ! -f "${APP_DIR}/templates/.copied" ]]; then
chown -R hotio:hotio "${CONFIG_DIR}/templates"
touch "${APP_DIR}/templates/.copied"
fi

if [[ ! -d "${CONFIG_DIR}/crontab" ]]; then
echo "Installing default \"crontab\"..."
cp -R "${APP_DIR}/crontab" "${CONFIG_DIR}/"
chown -R hotio:hotio "${CONFIG_DIR}/crontab"
fi

if [[ -f "${CONFIG_DIR}/crontab/default" ]]; then
echo "Loading user provided \"crontab\" to system..."
crontab "${CONFIG_DIR}/crontab/default"
fi

if [[ ! -d "${CONFIG_DIR}/logrotate" ]]; then
echo "Installing default \"logrotate\"..."
cp -R "${APP_DIR}/logrotate" "${CONFIG_DIR}/"
chown -R hotio:hotio "${CONFIG_DIR}/logrotate"
fi
15 changes: 0 additions & 15 deletions root/etc/cont-init.d/03-config-cron

This file was deleted.

0 comments on commit 0d86f70

Please sign in to comment.