mirror of
https://github.com/msfjarvis/server-config
synced 2025-08-14 18:47:00 +05:30
systemd: run goaccess run every 10 minutes in non-live mode
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
4994dd060a
commit
8ee6ac80de
3 changed files with 29 additions and 1 deletions
12
systemd_units/goaccess-update.timer
Normal file
12
systemd_units/goaccess-update.timer
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Run goaccess every 10 minutes to update statistics
|
||||||
|
Requires=goaccess.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Unit=goaccess.service
|
||||||
|
OnUnitInactiveSec=10m
|
||||||
|
RandomizedDelaySec=10m
|
||||||
|
AccuracySec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
|
@ -10,7 +10,7 @@ RestartSec=2s
|
||||||
Type=simple
|
Type=simple
|
||||||
User=caddy
|
User=caddy
|
||||||
Group=caddy
|
Group=caddy
|
||||||
ExecStart=/usr/bin/goaccess --log-format=VCOMMON --ws-url=wss://stats.msfjarvis.dev/ws --output=/var/www/stats.msfjarvis.dev/index.html --log-file=/etc/logs/requests.log --no-query-string --anonymize-ip --double-decode --real-os --compression=zlib --real-time-html
|
ExecStart=/usr/bin/goaccess --log-format=VCOMMON --output=/var/www/stats.msfjarvis.dev/index.html --log-file=/etc/logs/requests.log --no-query-string --anonymize-ip --double-decode --real-os --compression=zlib
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
# Security
|
# Security
|
||||||
|
|
|
@ -9,6 +9,7 @@ function prettyPrint() {
|
||||||
|
|
||||||
# Grab all service names
|
# Grab all service names
|
||||||
declare -a services=('caddy' 'goaccess' 'mirror-bot' 'mirror-bot-2' 'uno-bot' 'walls-bot' 'walls-bot-rs')
|
declare -a services=('caddy' 'goaccess' 'mirror-bot' 'mirror-bot-2' 'uno-bot' 'walls-bot' 'walls-bot-rs')
|
||||||
|
declare -a timers=('goaccess-update')
|
||||||
|
|
||||||
# Now loop through each service and install it
|
# Now loop through each service and install it
|
||||||
for service in "${services[@]}"; do
|
for service in "${services[@]}"; do
|
||||||
|
@ -29,3 +30,18 @@ for service in "${services[@]}"; do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for timer in "${timers[@]}"; do
|
||||||
|
if [ "${1}" ] && [[ ${timer} != "${1}" && "${timer}.timer" != "${1}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
prettyPrint "Checking root access"
|
||||||
|
sudo -v || return 1
|
||||||
|
prettyPrint "Installing ${timer}"
|
||||||
|
sudo cp -v "${timer}.timer" /etc/systemd/system/
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
if [ -z "${NO_RESTART}" ]; then
|
||||||
|
prettyPrint "Enabling ${timer}"
|
||||||
|
sudo systemctl enable "${timer}.timer"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue