[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Scheduling a Task

Posted on 2006-06-08
8
Medium Priority
?
303 Views
Last Modified: 2010-04-22
I want to be able to schedule a script (hopefully php) to run at a specified tme each day.

How can I do that?
0
Comment
Question by:Richard Korts
[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
8 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 16866142
man crontab
0
 
LVL 8

Assisted Solution

by:Autogard
Autogard earned 500 total points
ID: 16866507
In "/etc" you will (should) find a "cron.daily" folder (/etc/cron.daily).  Any script in there will run at a certain time each day.

If you don't really care what time it gets run then this is a good way to go (if you do care then you will need to specify the time -- the method for doing this may be different depending on which distribution you are running -- for suse check here: http://lists.suse.com/archive/suse-linux-e/2005-May/1103.html -- it may be the same on your distro too).  If you want more control over your cron then check "man crontab".

Also, are you familiar with running php scripts from the command line?  To do so just run "php" or "php5" from the command line (so you may need to create a shell script that does this and put that shell script in your cron.daily folder).  Also be aware that a php script run from the command line may not run exactly as it would from the web (different method for handling variables, etc...)  Make sure you test it first.  Another trick is to run your php script using a text browser (lynx or w3m) on the command line instead of using "php" or "php5" directly (that way the variables will work as they usually do).
0
 

Author Comment

by:Richard Korts
ID: 16873617
To Autogard:

Thanks for that detail information.

I need to make this work on a remote web server. I only have ftp access to it.

Lets take a VERY SPECIFIC example.

Suppose I wanted a php script housed in a folder called c:/websites/rkassociates.com/LSS/ to be run at 2AM daily. Suppose further the script was called savetrans.php.

How EXACTLY would I do that?

Thanks
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 3

Assisted Solution

by:root_start
root_start earned 500 total points
ID: 16874688
Hi rkorts,

What do you mean by: "I need to make this work on a remote web server. I only have ftp access to it."?
The script in one server and you need to execute it in another server where the web server is, also, you only have ftp access to this server?

If you only have ftp access to this server, you will not be able to execute it.

About cron, check the link below, it will help you to configure what you need and also will show how cron works. =0)
    - http://www.unixgeeks.org/security/newbie/unix/cron-1.html

I hope it helps. =0)
0
 
LVL 8

Expert Comment

by:Autogard
ID: 16874900
Sorry for the delayed response...  Yeah, if you only have ftp access I don't think you will be able to use cron then to schedule your task.  You would need to have the remote server administrator agree to set up the cron for you.

Also, why would your php script be in c:/<whatever>?  I thought this was a linux question?  Is the server you want the cron to run on a windows/linux machine?

Here is a trick you could try though -- you could set up your own machine (through cron or otherwise) to automatically access the php page on the web server at 2AM just using a browser like firefox or even a text browser.  Of course your own machine would have to be turned on every morning at 2AM for this to work.  Is that something you would be interested in trying out?
0
 
LVL 4

Assisted Solution

by:Phreonx
Phreonx earned 500 total points
ID: 17016617
Hello,
it's been like 20 days since the last post to this question and I don't even know if you have resolved your problem rkorts. Remote execution of commands via the FTP protocol is possible but since the command I'm about to tell you is not part of the formal FTP specification, this command is not official. Successful execution of this command depends entirely on whether the FTP Server has been setup to support it or not [default: NO and I believe you can understand why]. Anyway, the command is: site exec.
Since it is very unlikely to have enabled support for this command on the FTP Server, know that otherwise you cannot execute remote commands on any remote workstation/server VIA the FTP protocol. Howver, ssh is perhaps the way to go. But you will need to have it setup on the remote end. Ask your administrator for this.

Hope this helps ;)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

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…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

650 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