#!/bin/bash # # priority: 900 # # Configure cron jobs # # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # # $Id$ # # Source function library and configuration . /etc/plc.d/functions . /etc/planetlab/plc_config # Be verbose set -x # Export so that we do not have to specify -p to psql invocations export PGPORT=$PLC_DB_PORT case "$1" in start) MESSAGE=$"Starting crond" dialog "$MESSAGE" if [ "$PLC_MAIL_ENABLED" = "1" ] ; then MAILTO=$PLC_MAIL_SUPPORT_ADDRESS else MAILTO= fi cat >/etc/cron.d/plc.cron <>/etc/cron.d/plc.cron wget -O - -q http://localhost/cron.php check fi if [ "$PLC_DNS_ENABLED" = "1" ] ; then echo "*/15 * * * * root dns-config" >>/etc/cron.d/plc.cron dns-config check fi if [ "$PLC_DB_ENABLED" = "1" ] ; then echo "5 5 * * * root vacuumdb -U postgres --all --analyze --quiet" >>/etc/cron.d/plc.cron vacuumdb -U postgres --all --analyze --quiet check fi if [ "$PLC_WWW_ENABLED" = "1" ] ; then echo "*/15 * * * * root clean-empty-dirs.py /var/tmp/bootmedium" >> /etc/cron.d/plc.cron clean-empty-dirs.py /var/tmp/bootmedium check fi plc_daemon crond check result "$MESSAGE" ;; stop) MESSAGE=$"Stopping crond" dialog "$MESSAGE" killproc plc_crond check result "$MESSAGE" ;; esac exit $ERRORS