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
24 hostfile
="$dir/`hostname -f`"
25 # if [ ! -e "$hostfile" ]; then
26 # echo "loadcron: $hostfile does not exist, not loading" >&2
32 if [ -e "$dir/common" ]; then
33 echo "# From $dir/common:"
34 sed "s!\$HOME!$HOME!" < "$dir/common"
37 hostfile
="$dir/`hostname -f`"
38 if [ -e "$hostfile" ]; then
39 echo "# From $hostfile:"
44 debianedufile
=/org
/alioth.debian.org
/chroot
/home
/groups
/debian-edu
/cronjobs
/crontab.alioth
45 if [ "$(hostname)" = "haydn" ] && [ -e "$debianedufile" ]; then
46 echo "# From $debianedufile:"