How to edit CRONTAB file on Solaris


I rarely edit crontab files on our Solaris machines but then when I need to add or edit something I always experience the same problem and always searching for an answer 5-10 minutes. This time I will write solution in blog post for quick reminder.

Problem is, when I execute “crontab -e” to edit current crontab file I don’t get editor window.
I get something like this:

bash-2.05$ crontab -e

My problem is that I don’t have EDITOR environment variable set.

I have to do something like this:

bash-2.05$ export EDITOR=vi
bash-2.05$ crontab -e
#Then I will receive proper output to edit crontab file
30 21 * * * /opt/oracle/product/9.2.0/local/script1
30 22 * * * /opt/oracle/product/9.2.0/local/script2

To avoid this problem happening any more I will add EDITOR environment variable in my “.profile” file:

bash-2.05$ cd ~
bash-2.05$ vi .profile
set -am -o vi
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/9.2.0
export EDITOR=vi
export ORACLE_SID=db
exec bash

Now, every time I login on this machine environment variable for EDITOR will be automatically set and I won’t have problems with “crontab -e” any more.


This entry was posted in Solaris and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s