script to update node package repository and sign packages
[myplc.git] / plc.d / crond
1 #!/bin/bash
2 #
3 # priority: 900
4 #
5 # Configure cron jobs
6 #
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
9 #
10 # $Id: crond,v 1.1 2006/04/06 21:51:59 mlhuang Exp $
11 #
12
13 # Source function library and configuration
14 . /etc/plc.d/functions
15 . /etc/planetlab/plc_config
16
17 case "$1" in
18     start)
19         MESSAGE=$"Starting crond"
20         dialog "$MESSAGE"
21
22         if [ "$PLC_MAIL_ENABLED" = "1" ] ; then
23             MAILTO=$PLC_MAIL_SUPPORT_ADDRESS
24         else
25             MAILTO=
26         fi
27         cat >/etc/cron.d/plc.cron <<EOF
28 SHELL=/bin/bash
29 PATH=/sbin:/bin:/usr/sbin:/usr/bin
30 MAILTO=$MAILTO
31 HOME=/
32
33 # minute hour day-of-month month day-of-week user command
34 */5 * * * * root gen-slices-xml-05.py
35 */15 * * * * root gen-sites-xml.py
36 */15 * * * * root gen-static-content.py
37 EOF
38
39         # Run them once at startup
40         gen-slices-xml-05.py
41         check
42         gen-sites-xml.py
43         check
44         gen-static-content.py
45         check
46
47         plc_daemon crond
48         check
49
50         result "$MESSAGE"       
51         ;;
52
53     stop)
54         MESSAGE=$"Stopping crond"
55         dialog "$MESSAGE"
56
57         killproc plc_crond
58         check
59
60         result "$MESSAGE"       
61         ;;
62 esac
63
64 exit $ERRORS