Avatar of pavan27
pavan27Flag for United States of America asked on

how to create crontab file and add entires in crontab.

hai exprts,

i have couple of questions.
how to create corntab file. is it DBA responsibility or SA responsibility.
how to check if crontab file is exist or not. if file is not there then how do i create. or do i need to ask SA.
can i have more than one crontab file?
how to make entry on crontab file?
how to remove entries in crontab file?
Unix OS

Avatar of undefined
Last Comment

8/22/2022 - Mon

crontab can be created by normal users on the system as well as by SA.

The crontab is a schedule of scripts to run so it can have schedules of many scripts

the syntax is:

min hr dom mon dow command/script

The script should:

- be executable
- contains all needed env variables like HOME, PATH, etc
- commands and files should be referred to by full path names e.g. /usr/bin/ls /dir/file
- output and errors to be redirected e.g. /usr/bin/ls /dir/file > /path/to/mylog 2>&1

to create a crontab you need to:

EDITOR=vi ; export EDITOR

crontab -e

this will call for you a temp file which contains all existing job schedules (or empty file if none). Add or delete schedules from this temp file then save and exit. The temp file will be edited using vi commands

you may add schedules like

0 12 * * * /path/to/myscript

for more info please see

man crontab
man cron


i am getting this error.

VMPPRD:cavecreek:{oracle}70% crontab -l
crontab: can't open your crontab file.

what could be the reason

it could be that you don't have any schedule so far. create one then try again
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

{oracle}75% export EDITOR=vi
export: Command not found.

:{oracle}75% EDITOR=vi ; export EDITOR
EDITOR=vi: Command not found.
export: Command not found.

i am not able to set editor too

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

:{oracle}82% echo $SHELL

did you try

EDITOR=vi ; export EDITOR

any way you can do it other way:

vi mycron

add to it the schedule e.g.

0 12 * * * /path/to/myscript

save and exit


crontab mycron
crontab -l
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.