basic setup for Isabelle cronjob;
authorwenzelm
Tue Oct 11 20:20:32 2016 +0200 (2016-10-11)
changeset 64148bbf43b7c4d0d
parent 64147 92066f8c6a54
child 64149 1380bf90d986
basic setup for Isabelle cronjob;
Admin/cronjob/README
Admin/cronjob/crontab.lxbroy10
Admin/cronjob/main
Admin/cronjob/self_update
src/Pure/Admin/isabelle_cronjob.scala
src/Pure/build-jars
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Admin/cronjob/README	Tue Oct 11 20:20:32 2016 +0200
     1.3 @@ -0,0 +1,13 @@
     1.4 +Administrative Isabelle cronjob at TUM
     1.5 +======================================
     1.6 +
     1.7 +- crontab: manual update on target machine
     1.8 +    crontab -l
     1.9 +    crontab -e
    1.10 +
    1.11 +- self_update: manual installation on target directory
    1.12 +    cp "$ISABELLE_HOME/Admin/cronjob/self_update "$HOME/cronjob/self_update"
    1.13 +
    1.14 +- $HOME/cronjob/run/ -- run-time state
    1.15 +
    1.16 +- $HOME/cronjob/log/ -- cumulative log area
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Admin/cronjob/crontab.lxbroy10	Tue Oct 11 20:20:32 2016 +0200
     2.3 @@ -0,0 +1,5 @@
     2.4 +SHELL=/bin/bash
     2.5 +MAILTO=wenzelm
     2.6 +
     2.7 +03 00 * * *       $HOME/cronjob/self_update
     2.8 +17 00 * * *       $HOME/cronjob/isabelle/Admin/cronjob/main -f > $HOME/cronjob/run/main.out >> $HOME/cronjob/run/main.err
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Admin/cronjob/main	Tue Oct 11 20:20:32 2016 +0200
     3.3 @@ -0,0 +1,11 @@
     3.4 +#!/usr/bin/env bash
     3.5 +#
     3.6 +# DESCRIPTION: start the main Isabelle cronjob
     3.7 +
     3.8 +THIS="$(cd "$(dirname "$0")"; pwd)"
     3.9 +
    3.10 +source "$HOME/.bashrc"
    3.11 +
    3.12 +"$THIS/../build" jars || exit $?
    3.13 +
    3.14 +exec "$THIS/../../bin/isabelle_java" isabelle.Isabelle_Cronjob "$@"
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/Admin/cronjob/self_update	Tue Oct 11 20:20:32 2016 +0200
     4.3 @@ -0,0 +1,14 @@
     4.4 +#!/bin/bash
     4.5 +#
     4.6 +# self-update of the administrative isabelle repository
     4.7 +#
     4.8 +# Need to copy this file manually to $HOME/cronjob in order to
     4.9 +# avoid overwriting the running self_update by itself!
    4.10 +
    4.11 +source "$HOME/.bashrc"
    4.12 +
    4.13 +cd "$HOME/cronjob"
    4.14 +mkdir -p run log
    4.15 +
    4.16 +hg -R isabelle pull -q || echo "self_update pull failed"
    4.17 +hg -R isabelle update -C -q || echo "self_update update failed"
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/Pure/Admin/isabelle_cronjob.scala	Tue Oct 11 20:20:32 2016 +0200
     5.3 @@ -0,0 +1,43 @@
     5.4 +/*  Title:      Pure/Admin/isabelle_cronjob.scala
     5.5 +    Author:     Makarius
     5.6 +
     5.7 +Main entry point for administrative cronjob at TUM.
     5.8 +*/
     5.9 +
    5.10 +package isabelle
    5.11 +
    5.12 +
    5.13 +object Isabelle_Cronjob
    5.14 +{
    5.15 +  def main(args: Array[String])
    5.16 +  {
    5.17 +    Command_Line.tool0 {
    5.18 +      var force = false
    5.19 +      var verbose = false
    5.20 +
    5.21 +      val getopts = Getopts("""
    5.22 +Usage: Admin/cronjob/main [OPTIONS]
    5.23 +
    5.24 +  Options are:
    5.25 +    -f           apply force to do anything
    5.26 +    -v           verbose
    5.27 +""",
    5.28 +        "f" -> (_ => force = true),
    5.29 +        "v" -> (_ => verbose = true))
    5.30 +
    5.31 +      val more_args = getopts(args)
    5.32 +      if (more_args.nonEmpty) getopts.usage()
    5.33 +
    5.34 +      if (verbose) Output.writeln("This is the Isabelle cronjob")
    5.35 +
    5.36 +      val rc =
    5.37 +        if (force) {
    5.38 +          Thread.sleep(Time.seconds(30).ms)
    5.39 +          0
    5.40 +        }
    5.41 +        else { Output.warning("Need to apply force to do anything"); 1 }
    5.42 +
    5.43 +      if (rc != 0) sys.exit(rc)
    5.44 +    }
    5.45 +  }
    5.46 +}
     6.1 --- a/src/Pure/build-jars	Tue Oct 11 17:00:20 2016 +0200
     6.2 +++ b/src/Pure/build-jars	Tue Oct 11 20:20:32 2016 +0200
     6.3 @@ -9,6 +9,7 @@
     6.4  ## sources
     6.5  
     6.6  declare -a SOURCES=(
     6.7 +  Admin/isabelle_cronjob.scala
     6.8    Concurrent/consumer_thread.scala
     6.9    Concurrent/counter.scala
    6.10    Concurrent/event_timer.scala