Skip to content

Sysadmin grodoudou wikizamcron 12062012

Yannouk edited this page Jul 5, 2012 · 1 revision

Session

  • user : root
  • host : grodoudou.seizam.com
  • date : 12/06/12 18:56
  • curpath : /home/yannouk

Commands

 [email protected]# echo "START LOG"> /var/log/wikizam-cron
 [email protected]# date
  • Edit /etc/crontab, see [1]
  • Check that it works
 [email protected]# tail -f /var/log/wikizam-cron
START LOG
[2012-06-12 17:02:01: Updating usages...]
[2012-06-12 17:02:01: Searching subscriptions to renew before 2012-06-19 17:02:01 which has not been notified ...]
OK: 0 record(s) updated
[2012-06-12 17:02:01: Archiving and resetting monthly usages...]
OK: 0 record(s) archived and reset
[2012-06-12 17:02:01: END]
[2012-06-12 17:02:01: 0 subscription(s) to check...]
[2012-06-12 17:02:01: END]
[2012-06-12 17:02:01: Criteria end_date = 2012-06-12 17:02:01]
[2012-06-12 17:02:01: Searching subscriptions to renew...]
[2012-06-12 17:02:01: 0 subscription(s) to renew]
[2012-06-12 17:02:01: Deactivating all remaining outdated subscriptions...]
OK, 0 subscription(s) deactivated
[2012-06-12 17:02:01: END]
 [email protected]# tail -n 50 /var/log/syslog
Jun 12 19:02:01 grodoudou /USR/SBIN/CRON[9432]: (root) CMD (( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php >> /var/log/wikizam-cron ) && ( echo "updateSubscriptions.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "updateSubscriptions.php cannot be located" | mail -s "Wikizam cron" root ))
Jun 12 19:02:01 grodoudou /USR/SBIN/CRON[9433]: (root) CMD (( test -x /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php --deadline=7 >> /var/log/wikizam-cron ) && ( echo "checkNextRenewals.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "checkNextRenewals.php cannot be located" | mail -s "Wikizam cron" root ))
Jun 12 19:02:01 grodoudou /USR/SBIN/CRON[9434]: (root) CMD (( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php --lifespan=60 >> /var/log/wikizam-cron ) ) || ( echo "updateUsages.php cannot be located" | mail -s "Wikizam cron" root ))
Jun 12 19:02:01 grodoudou suhosin[9439]: ALERT - script tried to disable memory_limit by setting it to a negative value -1 bytes which is not allowed (attacker 'REMOTE_ADDR not set', file 'unknown')
Jun 12 19:02:01 grodoudou suhosin[9441]: ALERT - script tried to disable memory_limit by setting it to a negative value -1 bytes which is not allowed (attacker 'REMOTE_ADDR not set', file 'unknown')
Jun 12 19:02:01 grodoudou suhosin[9440]: ALERT - script tried to disable memory_limit by setting it to a negative value -1 bytes which is not allowed (attacker 'REMOTE_ADDR not set', file 'unknown')
Jun 12 19:02:01 grodoudou /USR/SBIN/CRON[9430]: (CRON) info (No MTA installed, discarding output)
Jun 12 19:02:01 grodoudou /USR/SBIN/CRON[9429]: (CRON) info (No MTA installed, discarding output)
  • OK, so let's set the final frequencies
  • Edit /etc/crontab, see [2]

Files

  • [1] Edit /etc/crontab
--- old	2012-06-12 18:57:13.000000000 +0200
+++ new	2012-06-12 19:00:01.000000000 +0200
@@ -16,2 +16,10 @@
 
+# for testing, every hour at x.02
+2 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php >> /var/log/wikizam-cron ) && ( echo "updateSubscriptions.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "updateSubscriptions.php cannot be located" | mail -s "Wikizam cron" root )
+
+# for testing, every hour at x.02
+2 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php --deadline=7 >> /var/log/wikizam-cron ) && ( echo "checkNextRenewals.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "checkNextRenewals.php cannot be located" | mail -s "Wikizam cron" root )
+
+# for testing, every hour at x.02
+2 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php --lifespan=60 >> /var/log/wikizam-cron ) ) || ( echo "updateUsages.php cannot be located" | mail -s "Wikizam cron" root )
 
  • [2] Edit /etc/crontab
--- old	2012-06-12 19:03:10.000000000 +0200
+++ new	2012-06-12 19:05:29.000000000 +0200
@@ -16,10 +16,10 @@
 
-# for testing, every hour at x.02
-2 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php >> /var/log/wikizam-cron ) && ( echo "updateSubscriptions.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "updateSubscriptions.php cannot be located" | mail -s "Wikizam cron" root )
+# each days at 9 am (fr timezone)
+0 7	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateSubscriptions.php >> /var/log/wikizam-cron ) && ( echo "updateSubscriptions.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "updateSubscriptions.php cannot be located" | mail -s "Wikizam cron" root )
 
-# for testing, every hour at x.02
-2 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php --deadline=7 >> /var/log/wikizam-cron ) && ( echo "checkNextRenewals.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "checkNextRenewals.php cannot be located" | mail -s "Wikizam cron" root )
+# each days at 3 pm (fr timezone)
+0 11	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/checkNextRenewals.php --deadline=7 >> /var/log/wikizam-cron ) && ( echo "checkNextRenewals.php has run" | mail -s "Wikizam cron" root ) ) || ( echo "checkNextRenewals.php cannot be located" | mail -s "Wikizam cron" root )
 

-# for testing, every hour at x.02
-2 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php --lifespan=60 >> /var/log/wikizam-cron ) ) || ( echo "updateUsages.php cannot be located" | mail -s "Wikizam cron" root )
+# each 5 minutes
+*/5 *	* * *	root	( test -x /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php && cd /var/wikizam/deployed/ && ( php /var/wikizam/deployed/extensions/Wikiplaces/updateUsages.php --lifespan=60 >> /var/log/wikizam-cron ) ) || ( echo "updateUsages.php cannot be located" | mail -s "Wikizam cron" root )
 
Clone this wiki locally