diff --git a/aux-scripts/backupwiki b/wiki/backupwiki similarity index 100% rename from aux-scripts/backupwiki rename to wiki/backupwiki diff --git a/wiki/mwjobrunner b/wiki/mwjobrunner new file mode 100755 index 0000000..3c62050 --- /dev/null +++ b/wiki/mwjobrunner @@ -0,0 +1,15 @@ +#!/bin/bash + +MW_INSTALL_PATH=/usr/share/webapps/mediawiki +RUNJOBS=$MW_INSTALL_PATH/maintenance/runJobs.php +while true; do + # Job types that need to be run ASAP no matter how many of them are in the queue + # Those jobs should be very "cheap" to run + php $RUNJOBS -q --type="enotifNotify" + # Everything else, limit the number of jobs on each batch + # The --wait parameter will pause the execution here until new jobs are added, + # to avoid running the loop without anything to do + php $RUNJOBS -q --wait --maxjobs=20 + # Wait some seconds to let the CPU do other things, like handling web requests, etc + sleep 10 +done diff --git a/wiki/mwjobrunner.service b/wiki/mwjobrunner.service new file mode 100644 index 0000000..68eddde --- /dev/null +++ b/wiki/mwjobrunner.service @@ -0,0 +1,25 @@ +[Unit] +Description=MediaWiki Job runner +After=php-fpm.service postgresql.service + +[Service] +ExecStart=/usr/local/bin/mwjobrunner +Type=exec +Nice=10 +User=http +OOMScoreAdjust=200 +Restart=on-failure + +# from php-fpm.service +PrivateTmp=true +ProtectSystem=full +PrivateDevices=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectControlGroups=true +RestrictRealtime=true +RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX +RestrictNamespaces=true + +[Install] +WantedBy=multi-user.target