Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Running a program at a certian time.

Posted on 2003-12-11
8
Medium Priority
?
235 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
Technology Partners: 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 150 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

730 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