PDA

View Full Version : how to set up or edit cron job from shell


o0O0o.o0O0o
07-09-2008, 08:08 AM
hi ,


I usually set up cron jobs in cpanel.
Now i want toset up cron job from shell , i have no idea how to do that.

i have the root access to account , so i want to set the cron job for database backups.


sometime like

vi crontab1

and then write the times

I want to see the contents of my cronjab which i have created in cpanel so that i can copy that.

Do anyone have idea where the cron tabs are saved so that i can access them from shell and see the contents

anarchy3200
07-09-2008, 03:26 PM
You should be able to use the command:
crontab -e
This will open the crontabs in your default editor, if you wish to change the editor then:
export EDITOR=vi
should do it.

If you are logged in as root then it may not show you the cronjob running as your web user, for this use the -u [user] switch on the crontab command.
To get your backup to run as root rather than your web user you should just have to move it from your web users cronjobs to your root cronjobs, i.e. copy the line across.

oesxyl
07-10-2008, 12:36 AM
$ apropos crontab



$ whatis crontab



$ man 1 crontab



$ man 5 crontab



$ man anacron


regards