2 # Construct a crontab based on files in ~/.cron and load it into cron.
3 # The file ~/.cron/username/fqdn is appended to the common file in the same
4 # directory. Note that the common file may have "$HOME" in it, as in
5 # "PATH=$HOME/bin". cron is too dumb to deal with that, so the expansion is
6 # handled by this script.
9 WARNING="# Automatically generated by loadcron; edit ~/.cron/ files instead."
11 if [ ! -z "`crontab -l`" ] && ! crontab -l | grep -q "$WARNING"; then
12 if [ "$1" != "-f" ]; then
13 echo "loadcron: Current crontab was not generated by loadcron; not changing." >&2
14 echo "loadcron: Use loadcron -f to override"
17 crontab -l > $HOME/tmp/oldcrontab
18 echo "loadcron: Old crontab is backed up to $HOME/tmp/oldcrontab"
22 dir=$HOME/.cron/`whoami`
23 if [ -d "$dir" ]; then
27 if [ -e "$dir/common" ]; then
28 echo "# From $dir/common:"
29 sed "s!\$HOME!$HOME!" < "$dir/common"
32 hostfile="$dir/`hostname -f`"
33 if [ -e "$hostfile" ]; then
34 echo "# From $hostfile:"
39 debianedufile=/org/alioth.debian.org/chroot/home/groups/debian-edu/cronjobs/crontab.alioth
40 if [ "$(hostname)" = "haydn" ] && [ -e "$debianedufile" ]; then
41 echo "# From $debianedufile:"