Visit Our UNIX and Linux User Community


Editing a CRON file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Editing a CRON file
# 1  
Old 05-18-2002
Editing a CRON file

Hi,

I am accessing CRON via telnet and want to set up some jobs. I have typed crontab -e to edit my cronfile but I can't seem to enter anything when I type on my keyboard. All I have is a flashing cursor at the top with ~ on the start of each line.

How can I enter the jobs and save this file? Thanks for any help

Regards,

Jaffy
# 2  
Old 05-18-2002
Network cron

when you edit a cron file using crontab -e

crontab use vi editor, to start typing hit the Esc key on your keyboard followed by i key to insert then you could start typing

to save hit the Esc key on your keyboard, then semi colom i.e :
followed by wq
# 3  
Old 05-18-2002
Re: cron

Quote:
Originally posted by hassan2
when you edit a cron file using crontab -e

crontab use vi editor, to start typing hit the Esc key on your keyboard followed by i key to insert then you could start typing

to save hit the Esc key on your keyboard, then semi colom i.e :
followed by wq
here the editor is decided by the EDITOR environment variable. the default is ed. you can set it to vi and then make the changes as mentioned above
# 4  
Old 05-20-2002
editing crontab

try this,

do a crontab -l
copy and paste all content to a new file
then using vi or any other editor, edit the new file to add jobs.
save changes and then run this command to submit this file to your crontab

#crontab newfilename

to confirm do a crontab -l

hope this works for you
# 5  
Old 05-21-2002
HI,
crontab -e is working fine if i do set the variable EDITOR=vi first.
ladwig
# 6  
Old 05-21-2002
Save a copy of the crontab for root

I would say that directly editing the crontab file is dangerous!

Holistic is close to my suggestion. You can do the following commands. I keep a copy of my root crontab for safe keeping.

crontab -l > tempcron # saves crontab to a file
vi tempcron # edit crontab file safely!!
crontab tempcron reapply changes to crontab with config file.


This is a foolproof way to modify the crontab. Sometimes if you get control chars in the crontab it may corrupt it.

Always use vi and edit using another file.

Smilie
# 7  
Old 05-22-2002
It sounds like the OP is getting dropped into vi, and doesn't know what to do from there.

Search for a vi reference or tutorial - that'll help.

And there nothing wrong with using the crontab command, as long as you're aware of what you're doing. You could just as easily replace the entire crontab incorrectly using "crontab filename" as you could making an error in vi / ed / whatever and saving before you exit.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #906
Difficulty: Easy
A Unix shell repeatedly prints a prompt, waits for a command line on stdin, and then carries out some action, as directed by the contents of the command line.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies

2. Shell Programming and Scripting

File editing help

Hello all, I'm new hear and a noob regarding file editing and awk, but I have a file that has one column and i want to add a new column, as the first column and it have the same data in the column. ex: file1 - 123456 654321 098765 567890 here is what i want my file to look like (tab... (3 Replies)
Discussion started by: J_Had
3 Replies

3. Shell Programming and Scripting

editing line in text file adding number to value in file

I have a text file that has data like: Data "12345#22" Fred ID 12345 Age 45 Wilma Dino Data "123#22" Tarzan ID 123 Age 33 Jane I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes: Data "1012345#22" Fred ID... (16 Replies)
Discussion started by: say170
16 Replies

4. Shell Programming and Scripting

Help with file editing while keeping file format intact

Hi, I am having a file which is fix length and comma seperated. And I want to replace values for one column. I am reading file line by line in variable $LINE and then replacing the string. Problem is after changing value and writing new file temp5.txt, formating of original file is getting... (8 Replies)
Discussion started by: Mruda
8 Replies

5. Shell Programming and Scripting

Cron on Solaris not editing.

I am working on Solaris machine. I have to add a cron for some operation, nut in SSH terminal crontab -l shows all related crons, but crontab -e instead of opening vi editor shows some number. Could any body tell what can be issue? (16 Replies)
Discussion started by: nixhead
16 Replies

6. UNIX for Dummies Questions & Answers

Editing a cron file with crontab

I want to set up a file with crontab to run the cron deamon so I can use at to schedule jobs. I think the crontab file (or whatever you call it) has to be set up. Currently, I don't have a crontab file (I checked by typing sudo crontab -u myusername -l), and I don't know the syntax for creating... (6 Replies)
Discussion started by: Ultrix
6 Replies

7. Shell Programming and Scripting

file editing

hi experts, please help me in writting the script.. i have two files file1 and file 2 i have to write a script which will take input parameters as file1 and file2 file1: ...... 1 2 3 4 file2: ..... 1 2 output (6 Replies)
Discussion started by: subhendu81
6 Replies

8. Shell Programming and Scripting

Help with editing file

I have a file of 100000 records. This file is created by concatenation of two files. I want to edit this file from record number 80,000 till the end and add "|N" for each record . How can I acheive this. Please suggest (4 Replies)
Discussion started by: dsravan
4 Replies

9. Solaris

editing cron

im running crontab -e as root, I keep getting, I set my editor to EDITOR=vi... # crontab -e 477 (2 Replies)
Discussion started by: csaunders
2 Replies

10. UNIX for Advanced & Expert Users

Editing the end of the file without loading the entire file

hi! I am a newbee. I would really appreciate if you can answer the following question: I have a huge data file, 214MB with several coloumns. I need to delete the very last line of the file. Everything I know takes a lot of time to do it ( because I have to open the file in an editor or run a... (3 Replies)
Discussion started by: Garuda
3 Replies

Featured Tech Videos