Advertisement

08.16.2008 at 04:11PM PDT, ID: 23654069 | Points: 500
[x]
Attachment Details

excute a command in N min (crontab)

Asked by JoshWegener in Linux Programming, PHP Scripting Language, Debian Linux

Tags: , , ,

So I have a PHP file, at the end of its execution I want it to start setup a command to execute in N min from now. I tried to use crontab (see below) but it does not execute the command.

How can I fix this? or is there a better command to do this?

I am using 1and1 shared hosting.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
setCronJob(date('i', strtotime('+5 minute')), "*", "*", "*", "*", "CLUpdater", "sourcepages/SomeFile.php");
 
	function setCronJob($min, $hour, $monthDay, $monthNum, $weekDay, $cronName, $page){
		$command = "$min $hour $monthDay $monthNum $weekDay php -f /homepages/42/d160091301/htdocs/WebSites/MySite.com/www/$page";
		$cron_file = "/homepages/ID/User/htdocs/WebSites/MySite.com/cronJobs/cron_$cronName.job";
 
		// check for Feed_cron file. If it doesn't exist create it.
		// you must create the file from the browser to associate the proper group
		if (file_exists($cron_file)){  // if it exists, write new command
			$open = fopen($cron_file, "w"); // This overwrites current line
			fwrite($open, $command);
			fclose($open);
 
			// this will reinstate your Cron job
			exec("crontab $cron_file");
		} else { // if it Doesn't exist, Create it then write command
			touch($cron_file); // create the file, Directory "cron" must be writeable
			chmod($cron_file, 0777); // make new file writeable
 
			$open = fopen($cron_file, "w");
			fwrite($open, $command);
			fclose($open);
 
			// start the cron job!
			exec("crontab $cron_file");
		}
	}
 
Loading Advertisement...
 
[+][-]08.16.2008 at 04:23PM PDT, ID: 22245542

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 04:29PM PDT, ID: 22245557

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 06:18PM PDT, ID: 22245799

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 06:41PM PDT, ID: 22245852

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 07:00PM PDT, ID: 22245878

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 07:17PM PDT, ID: 22245911

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 07:19PM PDT, ID: 22245915

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 07:54PM PDT, ID: 22245974

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2008 at 08:36PM PDT, ID: 22246026

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.17.2008 at 07:12AM PDT, ID: 22246976

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.17.2008 at 07:29AM PDT, ID: 22247023

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.17.2008 at 07:35AM PDT, ID: 22247040

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.17.2008 at 07:47AM PDT, ID: 22247079

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.17.2008 at 04:09PM PDT, ID: 22248561

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.18.2008 at 07:39AM PDT, ID: 22252265

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.18.2008 at 08:12AM PDT, ID: 22252614

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.18.2008 at 08:23AM PDT, ID: 22252708

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.18.2008 at 02:02PM PDT, ID: 22255461

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628