Only restart prosody if the daemon isn't running

This commit is contained in:
Bob Mottram 2018-03-22 10:52:41 +00:00
parent 875bb191e7
commit b8eaf17ee0
1 changed files with 10 additions and 4 deletions

View File

@ -414,10 +414,16 @@ function prosody_daemon_restart_script {
# On rare occasions the daemon appears to get stuck
# i.e. still active, but not accepting connections
# This ensures that it will unstick itself at least once per day
if [ ! -f /etc/cron.daily/prosody ]; then
echo '#!/bin/bash' > /etc/cron.daily/prosody
echo 'systemctl restart prosody' >> /etc/cron.daily/prosody
chmod +x /etc/cron.daily/prosody
if [ -f /etc/cron.daily/prosody ]; then
rm /etc/cron.daily/prosody
fi
if [ ! -f /etc/cron.hourly/prosody ]; then
{ '#!/bin/bash';
"is_active=\$(systemctl is-active prosody)";
"if [[ \"\$is_active\" != 'active' ]]; then";
' systemctl restart prosody'
'fi'; } > /etc/cron.hourly/prosody
chmod +x /etc/cron.hourly/prosody
fi
}