Solved

Running a program at a certian time.

Posted on 2003-12-11
8
226 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
  • 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
 

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now