melwong
asked on
Newbie Cronjob issue on CentOS
I am VERY new to cronjobs. I access my shell and wanted to do cronjob.
After i type crontab -e, i added one new line of cronjob to do. Then the attached image screen appear asking me if i want to write to the file /tml/crontab.XXXXsomething something.
What is the next step i should take? send M-A Append command? How you type M-A?
cronjob-issue.JPG
After i type crontab -e, i added one new line of cronjob to do. Then the attached image screen appear asking me if i want to write to the file /tml/crontab.XXXXsomething
What is the next step i should take? send M-A Append command? How you type M-A?
cronjob-issue.JPG
here some links that help in understanding and using crontab
http://www.adminschoice.com/docs/crontab.htm
http://www.tutorial5.com/content/view/95/51/
http://www.adminschoice.com/docs/crontab.htm
http://www.tutorial5.com/content/view/95/51/
ASKER
can u just tell me how to use VI? i understand crontab, i just don't understand how to use VI with crontab as shown in my image.
vi is complex, use nano and you will understand from the screen
if ur done with the editing
just hit
ZZ
just hit
ZZ
ASKER
ok, how do u press "M-A" to Append? see my image
in that screen, just hit enter.., and then exit it
nano is very simple, stick to it... do your edits, use ctrl+X to EXIT, then Y to save ... you should be done.
nano is very simple, stick to it... do your edits, use ctrl+X to EXIT, then Y to save ... you should be done.
ASKER
do you guys even look at my image attached here? when i enter ZZ, the cron list shows ZZ.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why don't you do the following:
1- run from command line
crontab -l > mycron
2- edit the file mycron with any text editor of your choice (e.g. vi :) ) to add the required schedule, then save and exit from text editor
3- run the command
crontab mycron
4- verify that your crotab jobs are ok
crontab -l
1- run from command line
crontab -l > mycron
2- edit the file mycron with any text editor of your choice (e.g. vi :) ) to add the required schedule, then save and exit from text editor
3- run the command
crontab mycron
4- verify that your crotab jobs are ok
crontab -l
ASKER
N/a
sorry, I thought you were using VI for crontab. In that screenshot you are using nano.
At that screen just hit Enter as maysara mentioned.
At that screen just hit Enter as maysara mentioned.
He's only fighting with the editor. Taht won't help!
And he's still using vi instead of nano. nano is probably by far too easy form him.
In case your in insert mode in vi, type
ESC :wq
In case not in insert mode, just type
:wq
Then use nano as described above to check what has been saved and modify to your liking!
And he's still using vi instead of nano. nano is probably by far too easy form him.
In case your in insert mode in vi, type
ESC :wq
In case not in insert mode, just type
:wq
Then use nano as described above to check what has been saved and modify to your liking!
ASKER
ok,
I manage to put in the cronjob, but now I'm getting this error when the cron is executed.
/home/uplayuwi/public_html /WEB-INF/c lasses/ran k_alert.sh : line 1: ?cd: command not found
/home/uplayuwi/public_html /WEB-INF/c lasses/ran k_alert.sh : line 3: java: command not found
I manage to put in the cronjob, but now I'm getting this error when the cron is executed.
/home/uplayuwi/public_html
/home/uplayuwi/public_html
well, you'r script is apparently broken (at least when run in cron), you need to understand that the cron job is executed in a shell where bashrc is not run, nor the user profile, so the environment is not identical to that of your login shell ... you either need to handle this in your script (i.e, setting full pathes where needed, setting environment variables) or manually mimic login shells (by manually from script running the rc's and profile ..etc)
The first line should read
#!/bin/sh
#!/bin/sh
See "man vi" for information on vi.
If you want to use a different editor you must first do a
export EDITOR=editor_of_your_choi
e.g.
export EDITOR=nano
Then crontab -e will start another editor.
For this simple type of editing nano is a good choice. The few necessary commands are explained in the editor window. Or simply play with nano beforehand.