source: branches/locker-dev/locker/bin/cronload

Last change on this file was 1576, checked in by geofft, 14 years ago
cronload: Warn if no MAILTO= line is set.
  • Property svn:executable set to *
File size: 1.3 KB
RevLine 
[127]1#!/bin/sh
2
[1564]3usage="Usage \"$0 [-l lockername] [-h] crontab\""
[1563]4while getopts "l:h" options; do
5    case $options in
6        l ) lname=$OPTARG;;
7        h ) echo "$usage"; exit 0;;
[1564]8        * ) echo "$usage"; exit 1;;
[1563]9    esac
10done
11shift `expr $OPTIND - 1`
12if [ -z "$1" ]; then
13    echo "$usage"
14    exit 1
15fi
16
[127]17echo "This program should print your new crontab below."
18echo "If it does not do so, something is wrong."
19echo "Feel free to contact scripts@mit.edu for assistance."
20echo
21
[1563]22
[127]23cwd=`pwd`
[1563]24if [ -z "$lname" ]; then
25    lname=`perl -e "\\\$temp = \"$cwd\"; \\\$temp =~ /\\\/([^\\\/]+)\\\/cron_scripts/; print \\\$1"`
26fi
27if [ -z "$lname" ]; then
28    echo "ERROR: Could not detect locker name. Make sure to run"
29    echo "cronload from within /mit/lockername/cron_scripts/"
30    echo "(or pass the -l lockername option)"
31    exit 1
32fi
[463]33athrun scripts scripts-ssh "$lname" /usr/local/bin/cronload "$1" "$cwd" 2>/dev/null
[1576]34if ! grep -q "^MAILTO=" "$1"; then
35    echo "WARNING: You have no MAILTO= variable set. This means any"
36    echo "cron errors will go to $lname@scripts.mit.edu (your mail_scripts"
37    echo "account), which is almost certainly not what you want!"
38    echo "Please add a MAILTO= line, e.g., MAILTO=${EMAIL:-${ATHENA_USER:-$USER}@mit.edu},"
39    echo "to your crontab. If you do not want to receive errors, set"
40    echo 'MAILTO="".'
41fi
Note: See TracBrowser for help on using the repository browser.