• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

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.
0
drtsystems
Asked:
drtsystems
  • 3
  • 3
  • 2
1 Solution
 
yuzhCommented:
you can use cron to schedule your program,

man crontab

to learn more. (please read the example in the man page)
0
 
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.
0
 
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).

0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
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?
0
 
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.
0
 
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)
0
 
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)
0
 
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!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now