Script to restart gnusocial daemons if needed

This commit is contained in:
Bob Mottram 2016-05-14 19:45:55 +01:00
parent c5b74fafff
commit 665fe8f761
1 changed files with 12 additions and 2 deletions

View File

@ -8439,6 +8439,16 @@ function install_gnu_social {
# update to the next commit
set_repo_commit /var/www/$MICROBLOG_DOMAIN_NAME/htdocs "GNU Social commit" "$MICROBLOG_COMMIT" $MICROBLOG_REPO
# add a script to check that the daemon is running
echo '#!/bin/bash' > /etc/cron.daily/gnusocial-daemons
echo 'daemon_lines=$(ps aux | grep "scripts/queuedaemon.php" | grep "/var/www")' >> /etc/cron.daily/gnusocial-daemons
echo 'if [[ $daemon_lines != *"/var/www/"* ]]; then' >> /etc/cron.daily/gnusocial-daemons
echo " echo \"Restarting GNU Social daemons\" | mail -s \"GNU Social daemons not found\" $MY_EMAIL_ADDRESS" >> /etc/cron.daily/gnusocial-daemons
echo " cd /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs" >> /etc/cron.daily/gnusocial-daemons
echo ' scripts/startdaemons.sh' >> /etc/cron.daily/gnusocial-daemons
echo 'fi' >> /etc/cron.daily/gnusocial-daemons
chmod +x /etc/cron.daily/gnusocial-daemons
if grep -Fxq "install_gnu_social" $COMPLETION_FILE; then
return
fi