logrotate: fix reload failures

Do not attempt to run "systemctl reload" on the open5gs services, unless
they are running. This fixes the logrotate service failing on this
postrotate script, if units are not running or not installed.
This commit is contained in:
Oliver Smith 2024-03-25 14:47:56 +01:00 committed by Sukchan Lee
parent 581d255c53
commit be7d08bffc
1 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,9 @@
postrotate
for i in nrfd scpd seppd pcrfd hssd ausfd udmd udrd upfd sgwcd sgwud smfd mmed amfd; do
systemctl reload open5gs-$i
if systemctl --quiet is-active open5gs-$i; then
systemctl reload open5gs-$i
fi
done
endscript
}