diff --git a/src/freedombone-app-gnusocial b/src/freedombone-app-gnusocial
index 6fd20b63..a5fc7816 100755
--- a/src/freedombone-app-gnusocial
+++ b/src/freedombone-app-gnusocial
@@ -222,27 +222,6 @@ function gnusocial_create_database {
     create_database gnusocial "$GNUSOCIAL_ADMIN_PASSWORD" $MY_USERNAME
 }
 
-function gnusocial_running_script {
-    # check that the daemon is running
-    echo '#!/bin/bash' > /etc/cron.hourly/gnusocial-daemons
-    echo -n 'daemon_lines=$(ps aux | grep "'>> /etc/cron.hourly/gnusocial-daemons
-    echo -n "${GNUSOCIAL_DOMAIN_NAME}">> /etc/cron.hourly/gnusocial-daemons
-    echo '/htdocs/scripts/queuedaemon.php" | grep "/var/www")' >> /etc/cron.hourly/gnusocial-daemons
-    echo 'if [[ $daemon_lines != *"/var/www/"* ]]; then' >> /etc/cron.hourly/gnusocial-daemons
-
-    echo "    ADMIN_USER=\$(cat $COMPLETION_FILE | grep 'Admin user' | awk -F ':' '{print \$2}')" >> /etc/cron.hourly/gnusocial-daemons
-    echo '    MY_EMAIL_ADDRESS=$ADMIN_USER@$HOSTNAME' >> /etc/cron.hourly/gnusocial-daemons
-    echo '    echo "Restarting GNU Social daemons" | mail -s "GNU Social daemons not found" $MY_EMAIL_ADDRESS' >> /etc/cron.hourly/gnusocial-daemons
-    echo "    cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs" >> /etc/cron.hourly/gnusocial-daemons
-    echo '    scripts/startdaemons.sh' >> /etc/cron.hourly/gnusocial-daemons
-    echo 'fi' >> /etc/cron.hourly/gnusocial-daemons
-    echo 'php scripts/delete_orphan_files.php > /dev/null' >> /etc/cron.hourly/gnusocial-daemons
-    echo 'php scripts/clean_thumbnails.php -y > /dev/null' >> /etc/cron.hourly/gnusocial-daemons
-    echo 'php scripts/clean_file_table.php -y > /dev/null' >> /etc/cron.hourly/gnusocial-daemons
-    echo 'php scripts/upgrade.php > /dev/null' >> /etc/cron.hourly/gnusocial-daemons
-    chmod +x /etc/cron.hourly/gnusocial-daemons
-}
-
 function reconfigure_gnusocial {
     echo -n ''
 }
@@ -334,9 +313,7 @@ function upgrade_gnusocial {
         rm /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php
     fi
 
-    function_check gnusocial_running_script
-    gnusocial_running_script
-
+    gnusocial_hourly_script gnusocial $GNUSOCIAL_DOMAIN_NAME
     upgrade_pleroma "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
 }
 
@@ -492,8 +469,7 @@ function install_gnusocial_main {
         return
     fi
 
-    function_check gnusocial_running_script
-    gnusocial_running_script
+    gnusocial_hourly_script gnusocial $GNUSOCIAL_DOMAIN_NAME
 
     function_check install_mariadb
     install_mariadb
diff --git a/src/freedombone-app-postactiv b/src/freedombone-app-postactiv
index 984c4fc0..16a136b8 100755
--- a/src/freedombone-app-postactiv
+++ b/src/freedombone-app-postactiv
@@ -197,30 +197,12 @@ function postactiv_create_database {
 }
 
 function postactiv_running_script {
-    # check that the daemon is running
-    echo '#!/bin/bash' > /etc/cron.hourly/postactiv-daemons
-    echo -n 'daemon_lines=$(ps aux | grep "' >> /etc/cron.hourly/postactiv-daemons
-    echo -n "${POSTACTIV_DOMAIN_NAME}" >> /etc/cron.hourly/postactiv-daemons
-    echo '/htdocs/scripts/queuedaemon.php" | grep "/var/www")' >> /etc/cron.hourly/postactiv-daemons
-    echo 'if [[ $daemon_lines != *"/var/www/"* ]]; then' >> /etc/cron.hourly/postactiv-daemons
+    gnusocial_hourly_script postactiv $POSTACTIV_DOMAIN_NAME
 
-    echo "    ADMIN_USER=\$(cat $COMPLETION_FILE | grep 'Admin user' | awk -F ':' '{print \$2}')" >> /etc/cron.hourly/postactiv-daemons
-    echo '    MY_EMAIL_ADDRESS=$ADMIN_USER@$HOSTNAME' >> /etc/cron.hourly/postactiv-daemons
-    echo '    echo "Restarting postactiv daemons" | mail -s "postactiv daemons not found" $MY_EMAIL_ADDRESS' >> /etc/cron.hourly/postactiv-daemons
-    echo "    cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs" >> /etc/cron.hourly/postactiv-daemons
-    echo '    scripts/startdaemons.sh' >> /etc/cron.hourly/postactiv-daemons
-    echo 'fi' >> /etc/cron.hourly/postactiv-daemons
-
-    echo "cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs" >> /etc/cron.hourly/postactiv-daemons
+    # This was a hack to fix a bug in master, but may no longer be needed
     echo "if ! grep -q \"//define('POSTACTIV',true);\" scripts/commandline.inc; then" >> /etc/cron.hourly/postactiv-daemons
     echo "  sed -i \"s|define('POSTACTIV',true);|//define('POSTACTIV',true);|g\" scripts/commandline.inc" >> /etc/cron.hourly/postactiv-daemons
     echo 'fi' >> /etc/cron.hourly/postactiv-daemons
-    echo 'php scripts/delete_orphan_files.php > /dev/null' >> /etc/cron.hourly/postactiv-daemons
-    echo 'php scripts/clean_thumbnails.php -y > /dev/null' >> /etc/cron.hourly/postactiv-daemons
-    echo 'php scripts/clean_file_table.php -y > /dev/null' >> /etc/cron.hourly/postactiv-daemons
-    echo 'php scripts/upgrade.php > /dev/null' >> /etc/cron.hourly/postactiv-daemons
-
-    chmod +x /etc/cron.hourly/postactiv-daemons
 }
 
 function reconfigure_postactiv {
diff --git a/src/freedombone-utils-gnusocialtools b/src/freedombone-utils-gnusocialtools
index a0991a68..c0159af4 100755
--- a/src/freedombone-utils-gnusocialtools
+++ b/src/freedombone-utils-gnusocialtools
@@ -236,4 +236,33 @@ function upgrade_pleroma {
     fi
 }
 
+function gnusocial_hourly_script {
+    gnusocial_type=$1
+    domain_name=$2
+
+    # check that the daemon is running
+    echo '#!/bin/bash' > /etc/cron.hourly/${gnusocial_type}-daemons
+    echo -n 'daemon_lines=$(ps aux | grep "' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo -n "${domain_name}" >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo '/htdocs/scripts/queuedaemon.php" | grep "/var/www")' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'if [[ $daemon_lines != *"/var/www/"* ]]; then' >> /etc/cron.hourly/${gnusocial_type}-daemons
+
+    echo "    ADMIN_USER=\$(cat $COMPLETION_FILE | grep 'Admin user' | awk -F ':' '{print \$2}')" >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo '    MY_EMAIL_ADDRESS=$ADMIN_USER@$HOSTNAME' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo -n "    echo \"Restarting ${gnusocial_type} daemons\" | mail -s \"${gnusocial_type} " >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'daemons not found" $MY_EMAIL_ADDRESS' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo "    cd /var/www/${domain_name}/htdocs" >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo '    scripts/startdaemons.sh' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'fi' >> /etc/cron.hourly/${gnusocial_type}-daemons
+
+    echo "cd /var/www/${domain_name}/htdocs" >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'php scripts/delete_orphan_files.php > /dev/null' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'php scripts/clean_thumbnails.php -y > /dev/null' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'php scripts/clean_file_table.php -y > /dev/null' >> /etc/cron.hourly/${gnusocial_type}-daemons
+    echo 'php scripts/upgrade.php > /dev/null' >> /etc/cron.hourly/${gnusocial_type}-daemons
+
+    chmod +x /etc/cron.hourly/${gnusocial_type}-daemons
+}
+
+
 # NOTE: deliberately there is no "exit 0"