crontab and shell access to my server to add a new scheduled task.

ian27

It all started at 3......
Hi guys,

Okay, I'm having a bit of a thick attack here. :confused:

I have installed some banner maintenance software on one of my websites. The software is called phpAdsNew. One of the things I have to set up is scheduling the maintenance script to run every 24 hours on the server. I have been told that I can do this using the crontab utility via the terminal.

I will need shell access to my server to add a new scheduled task. How do I do this? And how do I know if I can get shell access to my server?

I am then told to use the following command to export my existing scheduled tasks to a text file:

crontab -l > cron.txt

Apparently after exporting my existing tasks to a text file I can use any text editor I want to add tasks.

Huh?!? I'm sure to one of you mac programmers this is easy peasy lemon squeezy, but I'm completely lost with how to proceed with any of this. If somebody could at least point me in the right direction of how to get started, that would be a great help.

Thank you.

Ian
 
First off, check with you isp/host to see if they support shell access and if your account supports it. Not all do. For a quick check, try:

ssh yourdomain.com and see if you get a connection. You'll need to enter your admin username and password (the same one you use to FTP files up to your site).

If it works, hollar yay and move on. If not, call/email your host and see if they offer the feature. If they do, have them turn it on for your account. If they don't, then ask them if they can schedule the job on your behalf.

Ok, from here, assuming you're on, do the following.

crontab -e <enter>

This puts you in edit mode for your cron list.

Enter the cron commands and save the list. you're probably using VIM or a VI-like editor, so to save and exit type COLON W Q (colon gets you in command mode, w writes, q quits).

The cron commands you'll enter should look something like:

* 1 * * * /path/to/script

where "1" is for 1 am.

type (in a terminal) man 5 crontab <enter> to get details on the formatting of the crontab file.

Hope this helps.
 
Thanks Chris for the quick reply it was very helpful.

I tried accessing the shell in the way that you specified but it won't allow me to, so I've emailed the host to see if they will configure it so I can gain access.

Thank you, I'll let you know how I get on.

Ian
 
Back
Top