XLP Literate Program for all cron jobs

A.J.Hurst

Version 0.1

Table of Contents

1 Introduction
2 The Echuca Cron
3 The ERegnans Cron
4 The Flinders Cron
5 The Garedelyon Cron
6 The Orsay Cron
7 The Wolseley Cron
8 The Makefile
9 Migration
10 Indices
10.1 Files
10.2 Chunks
10.3 Identifiers


1. Introduction

This program generates, installs and initiates all cron jobs associated with Hurst computers.

<cron header 1.1> =
## ## ********************************************************** ## * DO NOT EDIT THIS FILE! * ## * Use $HOME/Computers/technical/cron.xlp instead * ## ********************************************************** ##
Chunk referenced in 2.1 3.1 4.1 5.1 6.1 7.1
<cron trailer 1.2> =
## ## The End ##
Chunk referenced in 2.1 3.1 4.1 5.1 6.1 7.1

2. The Echuca Cron

The echuca cron normally looks after wiki Backup and html flushing. The checkTime operation probably does not belong here.

"cron.echuca" 2.1 =
########################## ## CRON FILE for ECHUCA ## ########################## <cron header 1.1> HOME=/Users/ajh LOGS=/Users/ajh/logs/echuca DATE=`/Users/ajh/bin/date` INCRLOG=/Users/ajh/logs/echuca/backup/$DATE PYTHONLIB=/Users/ajh/lib/python:/Users/ajh/Church/Computers/rosters PYTHONPATH=/Users/ajh/lib/python:/home/ajh/Computers/python:/usr/local/lib/python PYTHON=/Users/ajh/Computers/python ROSTER=/Users/ajh/Church/Computers/rosters HOUSE=/Users/ajh/Computers/House SHELL=/bin/bash PATH=.:/sw/sbin:/sw/bin:/Users/ajh/bin/macosx:/Users/ajh/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin XML_CATALOG_FILES=/Users/ajh/etc/xml/catalog PYTHONPATH=/home/ajh/lib/python:/usr/local/lib/python #Mins Hour Day Month Weekday # html cache flushing 0 3 * * 1 find /Users/ajh/local/localhost/htmls -name \*.html -mtime +31 -print -exec rm {} \; ; du -sk /Users/ajh/local 0 3 * * 2 find /Users/ajh/local/ajh.co/htmls -name \*.html -mtime +31 -print -exec rm {} \; ; du -sk /Users/ajh/local 0 3 * * 3 find /Users/ajh/local/ajh.id.au/htmls -name \*.html -mtime +31 -print -exec rm {} \; ; du -sk /Users/ajh/local # wiki backup 18 1 * * * /usr/bin/rsync -auv eregnans:/var/wiki/gwuc/data/ /Users/ajh/local/wikiBackup/data/ # archives backup - do this after the previous cron 18 2 * * * /usr/bin/rsync -auv --exclude=cache /Users/ajh/ /Volumes/Pclass/Archives/ajh/ <cron trailer 1.2>

3. The ERegnans Cron

The eregnans cron essentially looks after the church wiki and rosters functionality.

"cron.eregnans" 3.1 =
############################ ## CRON FILE for EREGNANS ## ############################ <cron header 1.1> SHELL=/bin/bash PATH=.:/home/ajh/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin PYTHONPATH=/home/ajh/lib/python:/home/ajh/Computers/python:/usr/local/lib/python2.6 RSYNC_RSH="ssh -1 " XML_CATALOG_FILES=/home/ajh/etc/xml/catalog ROSTERS=/home/ajh/Church/Computers/rosters 15 2 * * 2 $HOME/Church/Computers/updateFromDB.sh #Mins Hour Day Month Weekday 20 1 1 6 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20150526 20 1 1 7 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20150623 20 1 1 8 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20150728 20 1 1 9 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20150825 20 1 1 10 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20150922 20 1 1 11 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20151027 20 1 1 12 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20151124 20 1 1 1 * python /home/ajh/Church/Computers/wiki/councilAction.py CouncilMinutes20151222 # #0 2 * * 1 $ROSTERS/runRosters.sh #0 15 * * 2 $ROSTERS/mailReminders.py #0 15 * * 2 mail -s rosterReminders david@morgands.net < $ROSTERS/rosterReminders.txt; mv $ROSTERS/rosterReminders.txt $ROSTERS/rosterReminders-`/bin/date "+\%Y\%m\%d"`.txt #0 16 * * 3 $ROSTERS/mailConsolidated.py -s #30 16 * * 3 mv $ROSTERS/consolidatedRoster.txt $ROSTERS/consolidatedRoster-`/bin/date "+\%Y\%m\%d"`.txt 10 * * * * /usr/bin/python /home/ajh/Church/Computers/wiki/parseWikiLog.py > /var/wiki/gwuc/data/pages/WikiLog/revisions/00000003 <cron trailer 1.2>

4. The Flinders Cron

The cron jobs allocated to flinders are generally those that relate to the public face of the home server. Exceptions are backups, in one instance for the Hurst server (eregnans) itself, and in the other case, making a copy of all ajh files in case of accidental disaster (like I screwed up). Note that this latter is NOT a proper backup, as it merely copies current files to a spare disk, and thus overwrites older versions of the current files. Need to investigate the hard-link based backup program I wrote some years back.

"cron.flinders" 4.1 =
############################ ## CRON FILE for FLINDERS ## ############################ <cron header 1.1> HOME=/home/ajh ROSTER=/home/ajh/Church/Computers/rosters HOUSE=/home/ajh/Computers/House SHELL=/bin/bash PATH=.:/home/ajh/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin PYTHONPATH=/home/ajh/Church/Computers/rosters:/home/ajh/lib/python:/usr/local/lib/python2.7 #Mins Hour Day Month Weekday # flinders backup 10 2 * * * /usr/bin/rsync -auv /home/ajh/ /disk1/ajh/ <cron trailer 1.2>

The updateLogs/Plots are run every 5 minutes. This has been moved back to flinders while we are in residence, along with the wikiBackup and html cache flushing.

5. The Garedelyon Cron

This is currently subsumed by the cron job specification in the HouseMade suite, and the essential (single) line is reproduced here. Somehow we should avoid this conflict!

The logHWS script is a legacy from central days, and is yet to be upgraded.

"cron.garedelyon" 5.1 =
############################## ## CRON FILE for GAREDELYON ## ############################## ## C R O N F I L E f o r G a r e d e l y o n <cron header 1.1> SHELL=/bin/bash #0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/ajh/bin/logHWS.sh PYTHONPATH = /usr/lib/python2.5:/usr/lib/python2.5/site-packages * * * * * /home/ajh/Computers/House/EveryMinute.sh <cron trailer 1.2>

6. The Orsay Cron

The cron jobs for orsay relate to controlling the house relays, and running the constant heating check.

"cron.orsay" 6.1 =
######################### ## CRON FILE for ORSAY ## ######################### <cron header 1.1> #min hour day month weekday task # adjustHeating * * * * * /bin/bash /home/ajh/Computers/House/EveryMinute.sh # watering cron jobs 0 7,19 * * * /usr/bin/python /home/ajh/Computers/House/RelayControl.py FloodNDrain 50 # 50 secs 0 7,19 * * * /usr/bin/python /home/ajh/Computers/House/RelayControl.py RainForest 600 # 10 mins #10 7,19 * * * /usr/bin/python /home/ajh/Computers/House/RelayControl.py BottomVegBed 900 # 15 mins #25 7,19 * * * /usr/bin/python /home/ajh/Computers/House/RelayControl.py MiddleVegBed 300 # 5 mins #30 7,19 * * * /usr/bin/python /home/ajh/Computers/House/RelayControl.py TopVegBed 1200 # 20 mins <cron trailer 1.2>

The watering jobs for TopVegBed, BottomVegBed, and RainForest cannot be run in overlap, not because the relay state cannot be shared (it now can), but because the pump does not deliver enough pressure to run all three simultaneously. (The FloodNDrain is a separate pump.) Note that 1800 = 30minutes x 60seconds.

The EveryMinute job is only run every 5 minutes at the moment, because there is not the same demand for it to be responsive to any changes made to the program, or to manual on/off events.

7. The Wolseley Cron

"cron.wolseley" 7.1 =
############################ ## CRON FILE for WOLSELEY ## ############################ ## C R O N F I L E f o r W o l s e l e y <cron header 1.1> SHELL=/bin/bash HOUSE=/home/ajh/Computers/House #min hour day month weekday task # various stuff moved to flinders # these following are back to wolseley, now that it is again the main house server */5 * * * * /home/ajh/bin/updateLogs.sh ; /home/ajh/bin/updatePlots.sh; ${HOUSE}/checkTime.py >>${HOUSE}/checkTime.log 12 * * * * /usr/bin/python /home/ajh/Computers/House/maxminTemp.py; rsync -auv /home/ajh/logs/garedelyon/maxmins.log garedelyon:/logdisk/logs/ # html cache flushing 0 3 * * 1 find /home/ajh/local/localhost/htmls -name \*.html -mtime +31 -print -exec rm {} \; ; du -sk /home/ajh/local 0 3 * * 2 find /home/ajh/local/ajh.co/htmls -name \*.html -mtime +31 -print -exec rm {} \; ; du -sk /home/ajh/local 0 3 * * 3 find /home/ajh/local/ajh.id.au/htmls -name \*.html -mtime +31 -print -exec rm {} \; ; du -sk /home/ajh/local # # wiki backup 18 1 * * * /usr/bin/rsync -auv eregnans:/var/wiki/gwuc/data/ /home/ajh/local/wikiBackup/data/ <cron trailer 1.2>

8. The Makefile

"Makefile" 8.1 =
SOURCEDIR=$(HOME)/Computers/technical HOST=$(HOSTNAME) default=program GenFiles = .program install-program include ${HOME}/etc/MakeXLP install: install-echuca install-flinders install-eregnans install-garedelyon install-orsay install-wolseley start: start-echuca start-flinders start-eregnans start-garedelyon start-orsay start-wolseley all: install start clean: litclean -rm $(GenFiles) start-%: install-% if [ "$(HOST)" = "$*" ] ; then \ crontab $(SOURCEDIR)/cron.$* ;\ else \ ssh $* crontab $(SOURCEDIR)/cron.$* ;\ fi touch start-$* install-%: make-% if [ "$(HOST)" != "$*" ] ; then \ rsync -auv cron.$* $*:$(SOURCEDIR)/ ;\ fi touch install-$* make-%: cron.tangle touch make-$* #cron.tangle: cron.xlp # from MakeXLP

9. Migration

A lot of the cron jobs defined about use legacy or out-of-date software. In order to manage the migration to new systems, the following dependencies are identified (by cron reference):

Cron Main Location Dependencies
ERegnans allRosterMail /home/ajh/Church/Computers/rosters copy, getopt, sys, subprocess (all standard libraries)
ERegnans genRoster /home/ajh/Church/Computers/rosters calendarNames (lib/python), SaltDuties (.), rosterAccess3 (.), datetime, getopt, math, re, sys (all standard libraries)
ERegnans eldersTally /home/ajh/Church/Computers/rosters calendarNames (lib/python), eldersDuties (should be SaltDuties) (lib/python), rosterAccess (lib/python), wikiAccess (.), datetime, getopt, math, re, sys (all standard libraries)
ERegnans rosterAccess3 /home/ajh/Church/Computers/rosters calendarNames (lib/python), wikiAccess (.), editmoin (lib/python), datetime, math, os, os.path, re, string, sys, urllib2 (all standard libraries)
20130820:111537 ajh 0.0 first draft, built from individual cron files
20131125:222602 ajh 0.1 omit central crons
20131227:165448 ajh 0.2 added garedelyon cron table, and migration section
20140127:141504 ajh 0.3 replace central with lilydale
20140425:114511 ajh 0.4 replace lilydale with ringwood
20150420:174011 ajh 0.5 add orsay, start to remove obsolete code (ringwood)

10. Indices

10.1 Files

File Name Defined in
Makefile 8.1
cron.echuca 2.1
cron.eregnans 3.1
cron.flinders 4.1
cron.garedelyon 5.1
cron.orsay 6.1
cron.wolseley 7.1

10.2 Chunks

Chunk Name Defined in Used in
cron trailer 1.2 2.1, 3.1, 4.1, 5.1, 6.1, 7.1

10.3 Identifiers

Identifier Defined in Used in

1215 accesses since 29 Dec 2017, HTML cache rendered at 20150508:0531