Friday, May 8, 2009

Crontab Basics on Solaris

Crontab is extremely useful and well documented all over the internet. Here i show how to make your experience with it a bit more pleasant.

First some key useful information.

  • Looking at current crons:
crontab -l

  • Editing crons:
crontab -e

  • Changing the crontab Editor
export EDITOR="gedit"

I prefer gedit to vim or pico :)
  • Crontab format
1. minute (from 0 to 59)
2. hour (from 0 to 23)
3. day of month (from 1 to 31)
4. month (from 1 to 12)
5. day of week (from 0 to 6) (0=Sunday)

* * * * * /bin/

means run every minute of every hour of every day of every month on all weekdays :)

PERMANENTLY changing your crontab editor preference:
Login using CDE. Open your home folder:

Right click in the open browser and select "Show Hidden Objects" :

Find .profile and add the following line as shown:
export EDITOR="gedit"

Leave anything else intact (unless you want to change something)

Now when you start editor using crontab -e you should get gedit