2014-01-14 4 views
0

아래의 PHP 파일을 내 서버에서 매일 실행하고 싶습니다. 나는이 그것을 할 것을 읽었습니다 (내 WHMCS 사용자 이름에 "이름을"변경 없음) :크론 (cron) 작업을 시작하는 방법

20 0 * * * php –q /home/username/whmcs/terminatedemo.php 

을하지만 난 이런 식으로 실행할 때이 오류 메시지가 : "지정되지 입력 파일"

을 나는의 cPanel 포럼 스레드에 따라 다음과 같이 그것을 실행하고있어 시도 동일한 결과 :

php -q -f /home/username/public_html/whmcs /home/username/public_html/whmcs/createdemo.php 
:

20 0 * * * php –q /home/username/whmcs /home/username/whmcs/terminatedemo.php 

난이 같은 시도

내가 오류를

잘못된 IP 주소 xxx.xx를 얻을이 마지막으로 ...

어떤 제안이?

감사합니다. (이 파일은 아래에 있습니다.)

<?php 
//RECREATING DEMO ACCOUNT 
$url = "http://yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file 
$whmcs_admin = "admin"; # Admin username goes here 
$whmcs_pw = "password"; 
$demo_account_id = "1"; 

$postfields["username"] = $whmcs_admin; 
$postfields["password"] = md5($whmcs_pw); 
$postfields["action"] = "servercreate"; 
$postfields["accountid"] = "1"; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 100); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); 
$data = curl_exec($ch); 
curl_close($ch); 

$data = explode(";",$data); 
foreach ($data AS $temp) { 
$temp = explode("=",$temp); 
$results[$temp[0]] = $temp[1]; 
} 
if ($results["result"]=="success") { 
print "Demo account terminated"; 
} else { 
# An error occured 
$error_msg = $results["message"]; 
mail("youremail", "Error terminating demo account", $error_msg,$headers); 
} 
?> 
+0

기본적으로'crontab -e'로 편집해야합니다. 'crontab -l'을 쓰면 현재의 cronjob을 보여줍니다. 또한 http://stackoverflow.com/tags/cron/info를 참조하십시오 – fedorqui

+0

안녕하세요 - 저는 지각 반응에 대해 사과 드리려고 누군가가 대답 할 때 이메일을받을 것이라고 생각했습니다. 파일을 편집하려고 시도했지만 할 수는 있지만 실제 스크립트가 작동하지 않습니다. 데모 cpanel 계정을 매일 설정 한 다음 매일 밤 해지하려고합니다. – thesales

답변

0

"이것이해야할 일"이라고 말하면 crontab 명령을 사용하고 있습니까? 그것은 cron 작업을 설정하기위한 인터페이스입니다 - "man crontab"을 수행하십시오.

간단히 말해서, 가장 쉬운 방법은 "crontab -e"를 사용하여 현재의 cron 파일로 편집기를 불러 와서 추가 명령을 추가하는 것입니다.

관련 문제