2014-08-31 3 views
0

나는 shell_exec PHP 함수와 리눅스 명령에서 2 일 동안 고생했다. 이 짧은하려면,이 작품 :shell_exec 및 at 명령과 함께 wget 사용?

shell_exec('/usr/bin/at 09:32 <<EOF 
     touch /var/www/website/hello.txt 
EOF' 
); 

이되지 않습니다

shell_exec('/usr/bin/at 09:32 <<EOF 
     wget -O - -q -t 1 "http://192.168.56.101/website/test.php?param=hello" >/dev/null 2>&1 
EOF' 

); 

이유는 무엇입니까?

(참고 : 위 코드는 콘솔에서 작동합니다.)

감사합니다.

+1

사용. 그리고'at '대신 cron을 사용하십시오. 'shell_exec'는 일반적으로 유해하고 최후의 수단으로 간주되어야합니다. – OmnipotentEntity

+0

작업이'at '로 끝나나요? (http://serverfault.com/questions/174678/how-do-i-print-contents-of-at-jobs) – GhostGambler

+0

'system_exec' 호출의 반환 값은 무엇입니까? – GhostGambler

답변

0

좋아요.

관심있는 사람들은 wget 명령을 전체 경로 (예 :/usr/bin/wget)와 함께 호출해야한다는 사실을 알게됩니다. 나를 오도하는 것은 터치 명령에 필요하지 않다는 것입니다. 그것은 이상한 어쨌든 여기에 작업 코드입니다 : [`file_get_contents`] (http://php.net/manual/en/function.file-get-contents.php) 대신 wget과의

shell_exec('/usr/bin/at 09:32 <<EOF 
     /usr/bin/wget -O - -q -t 1 "http://192.168.56.101/website/test.php?param=hello" >/dev/null 2>&1 
EOF' 
); 
+0

이것은 터치가 선반이기 때문입니다 l 내장. – OmnipotentEntity

+0

@OmnipotentEntity 아니요. – Rapptz

+0

네 말이 맞아! 죄송합니다 – OmnipotentEntity