Running a program at a certian time.

I am trying to make a program to tape a certian show whatever day of the week at a certian time.  I would like to be able to add information schedule the recording through a web interface using PHP.  My question is this: how can I have my program execute at a certian time certian days, whatever information is stored in my database (or however else) by the web interface.
drtsystemsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yuzhCommented:
you can use cron to schedule your program,

man crontab

to learn more. (please read the example in the man page)
drtsystemsAuthor Commented:
But is cron designed to be run in the way I am thinking?  I would be adding a CRON entry every time I wanted to scedule something for my program which would be a lot.  I was looking for something where I could just keep my program running.
jmcgOwnerCommented:
To schedule something to run once at a particular time in the future, use the "at" command. It's actually a subfacility of "cron" and will normally be installed on most Linux distributions.

You'd turn to using "cron" if you had something you wanted scheduled to run periodically (hourly, daily, etc).

Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

drtsystemsAuthor Commented:
I don't know much about linux, I am trying to take a program I wrote in Windows and re-reite it for Linux...  is cron overy precise, like could I tell it to do something at 11:56 every monday and it would be exactly 11:56?
jmcgOwnerCommented:
Yes, you can specify that something will run during a particular minute every Monday. It's sufficiently precise in that sense. If the system is down, or if the system's clock is off, or if it happens to be extremely loaded at that particular point in time -- these conditions might prevent exact precision, but they can mostly be controlled or guarded against.
yuzhCommented:
Here's an example of the crontab for your question:

56 11 * * 1 /path-to/your-prog >/dev/null 2>&1

To edit the crontab: (su as root, or login as root)

EDITOR=vi
export EDITOR
crontab -e

(use vi to edit the crontab)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
drtsystemsAuthor Commented:
how can I add and delete CRON entries from a PHP script?  (I can use a system command to run a system command, but I would like to be able to automatically add an entry, and then delete it again)
yuzhCommented:
To add/delete entires from the crontab, you must be the super user -- root.

It is better to write another script to maintain the cron entries, and make it running at the backgroup to do the job.

The details about how to do it worth a lot more than 50 points. and
you better put it in the programming TA, to see if any one want to
spend time to write it for you.

Good luck!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.