VISUAL
environment variable to vim
, and then use 'crontab -e
' to edit your crontab, you will probably find that the crontab is unchanged.vim
into vi
-compatible mode fixed the problem - but what's the point of using vim
if it behaves like vi
?vim
setting 'backupcopy=yes
' worked. I didn't know what the backupcopy
setting did, and so looked it up in the vim manual, and there was an explanation of the 'crontab -e
' problem!!!backupcopy=yes
' to get crontab
to recognize that you have changed the file, but that it's good idea to use the default setting of 'backupcopy=auto
' for most other editing. To achieve this, I've used the following two lines in my (and root's) .vimrc
file:filetype on
autocmd FileType crontab set backupcopy=yes
With a standard Slackware installation, you will not see any error output from scripts that you put in directories such as /etc/cron.daily
. This is because root's crontab redirects stdout to /dev/null
, and the /usr/bin/run-parts
script, which is run from the crontab, redirects stderr to the same place as stdout (i.e. /dev/null
).su -
mail
run-parts
script contains echo commands, so there will always be output that will be mailed to root! I've edited /usr/bin/run-parts
to get around this, replacing the lines:echo "$SCRIPT:"
echo
$SCRIPT 2>&1
echo
TEMPFILE=$(mktemp)
$SCRIPT >$TEMPFILE 2>&1
if [ -s $TEMPFILE ]
then
echo "$SCRIPT:"
echo
cat $TEMPFILE
echo
fi
rm -f $TEMPFILE