Solved

make the system run sript every day

Posted on 2006-11-22
5
178 Views
Last Modified: 2010-04-20
How can I run onhand.php every day at 18.00
0
Comment
Question by:teera
5 Comments
 
LVL 84

Assisted Solution

by:ozo
ozo earned 20 total points
ID: 18000131
man cron
0
 
LVL 95

Assisted Solution

by:Lee W, MVP
Lee W, MVP earned 50 total points
ID: 18000133
You can use a crontab entry for getting the script to run every day.

type man crontab for more info and crontab -e to edit the crontab file.
0
 
LVL 8

Accepted Solution

by:
jk2001 earned 70 total points
ID: 18000517
Read the cron and crontab man pages.

The line you'll want to add to your crontab is:

1 18 * * * /path/to/php /path/to/onhand.php

However, that probably won't work, because most PHP scripts are designed to run within the web server, and invoked by a call from a web browser.

In this case you should get either wget or curl (via your package manager), and use it to get the page via HTTP:

1 18 * * * /path/to/curl http://server/path/to/onhand.php >& /dev/null

The last bit dumps the data out to /dev/null so you don't end up with a new file somewhere.
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 80 total points
ID: 18000581
Assuming the onhand.php is a standalone PHP script, then do

crontab -e

and add

0 18 * * * /path/to/onhand.php

0
 
LVL 10

Assisted Solution

by:ssvl
ssvl earned 80 total points
ID: 18001280
# crontab -e

1 18 * * * php onhand.php



1 is minute ( it runs in fist minute of the spicfied hr)

18 hour  (

*  day ( * for every)

* month ( month of the Year)

* day of week ( 1 to 7 hence 1 and 7 for sunday)


php (command to exec)

onhand.php (script to exec)

0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 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