1758362 Members
2346 Online
108868 Solutions
New Discussion юеВ

crontab scheduling

 
MAYIANAN
Advisor

crontab scheduling

Hi guyz i am very new to crontab kind of scheduling. i need to add a job in crontab.

I tried with crontab -e to edit. It just opens a new line below the command prompt to add the new job. I don know how to save the added one. Also when i enter one job and press enter i get a "?" in next line and the cursor goes to 3rd line. plz let me know how to add a more than one job and save it.

Thx
7 REPLIES 7
Jeeshan
Honored Contributor

Re: crontab scheduling

crontab editing is like a vi editor editing.

If you familiar with vi then edit crontab using command crontab -e

then press "i" then place crontab schedule.If you want to enter multiple jobs simple enter after first job and place another line.
a warrior never quits
TTr
Honored Contributor

Re: crontab scheduling

The crontab -e opens your default editor specified by the EDITOR environment variable. Is it vi? And do you know how to use vi?

It also looks like your TERM variable may be wrong and vi starts up in line mode instead of screen mode.

type

echo $EDITOR
echo $TERM
Steven E. Protter
Exalted Contributor

Re: crontab scheduling

Shalom,

Your .kshrc file will determine such things as how your editor will work.

Take a look at the env for your your shell environment. I imagine some of the basics are missing.

Don't change the root shell in /etc/passwd that can cause crazy things to happen.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Arturo Galbiati
Esteemed Contributor

Re: crontab scheduling

Hi,
si mply type crontab and image to have a vi file to save at the end.
To simplify the work I usually use the following crontab template file to start new crontab:

###########################################################
# -
###########################################################
###########################################################
# BACKUP ON ....... ..:.. AM ... - ..: PM server time
###########################################################

# ---------------------------------------------------------
# Daily
# ---------------------------------------------------------
# minute hour monthday month weekday (0=Sunday) command
# 0-59 0-23 1-31 1-12 0-6
03 00 * * * crontab -l > file_cron

# ---------------------------------------------------------
# Weekly
# ---------------------------------------------------------
# minute hour monthday month weekday (0=Sunday) command
# 0-59 0-23 1-31 1-12 0-6

# ---------------------------------------------------------
# Montly
# ---------------------------------------------------------
# minute hour monthday month weekday (0=Sunday) command
# 0-59 0-23 1-31 1-12 0-6

# ---------------------------------------------------------
# OBSOLETE
# ---------------------------------------------------------
# minute hour monthday month weekday (0=Sunday) command

# ---------------------------------------------------------
# One shot
# ---------------------------------------------------------
# minute hour monthday month weekday (0=Sunday) command
# 0-59 0-23 1-31 1-12 0-6
#eof

This will include teh save of teh content of teh crontab itself.

HTH,
Art
Dennis Handly
Acclaimed Contributor

Re: crontab scheduling

You can of course edit your crontab entry externally from crontab -e:
$ crontab -l > cronfile
# edit it
$ crontab cronfile
MAYIANAN
Advisor

Re: crontab scheduling

just reopened the thread to submit the points. closing again
Dennis Handly
Acclaimed Contributor

Re: crontab scheduling

>just reopened the thread to submit the points.

You'll need to reopen, make sure you assign points, then close.