I was looking at our crontab on our backup server. This server is an Ubuntu 12.x LTS machine, and the logs for this were being sent to my predecessor, and I wanted to change the eMail address. The usual procedure is to run the following command to see and edit the contents of the crontab file:
This brings up the crontab file for the root user. Crontab is probably for another day, but basically the script shows a MAILTO address that I wanted to change.
# Edit this file to introduce tasks to be run by cron.
# m h dom mon dow command
0 23 * * * rsync -avz firstname.lastname@example.org:/opt/mysql_backup/ /backup/hive
0 18 * * * /backup/scripts/rsync_agave.sh
0 17 * * * /backup/scripts/rsync_basil.sh
0 1 * * * /backup/scripts/rsync_mysql1.sh
0 4 * * * /backup/scripts/rsync_mimic.sh
0 2 * * * /backup/scripts/rsync_petal2.sh
Running the crontab-e opens up the file in the default editor. Well, I didn’t even realize I had a default editor on this machine, and the file opened in vim, which is an archaic program, beloved by Unix freaks. I prefer the nano editor, especially because I don’t use a text editor much, and I know how nano works.
After some digging it appears that the default editor is set as an environment variable specific to the user. It can be changed by running the following command:
You can view your current environment variables, by typing
There will be a line similar to
In Ubuntu, you can also use the following command:
sudo update-alternatives –config editor
This will bring up a list of editors from which you can choose your favorite.