Solved

Running a program at a certian time.

Posted on 2003-12-11
8
231 Views
Last Modified: 2010-04-22
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
Comment
Question by:drtsystems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9925588
you can use cron to schedule your program,

man crontab

to learn more. (please read the example in the man page)
0
 

Author Comment

by:drtsystems
ID: 9925598
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
 
LVL 20

Expert Comment

by:jmcg
ID: 9925803
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:drtsystems
ID: 9927668
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
 
LVL 20

Expert Comment

by:jmcg
ID: 9927681
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
 
LVL 38

Accepted Solution

by:
yuzh earned 50 total points
ID: 9927875
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
 

Author Comment

by:drtsystems
ID: 9931736
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
 
LVL 38

Expert Comment

by:yuzh
ID: 9933999
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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question