[英]Shell Cron Error - What could cause this error?
Description: I am not very familiar with using a lot of bash/shell. 描述:我不太熟悉使用大量的bash / shell。 I currently have a cron tab set up on an Ubuntu server that runs a Shell script.
我目前在运行Shell脚本的Ubuntu服务器上设置了一个cron选项卡。 The Shell script then is suppose to run a PHP script, however, instead I am getting the following error message:
然后,Shell脚本将运行PHP脚本,但是,我收到以下错误消息:
Could not open input file: wscript.php 无法打开输入文件:wscript.php
At the top of my shell script I have written #!/bin/bash 在我的shell脚本的顶部,我写了#!/ bin / bash
Then the shell script itself I am passing a bash variable to PHP script. 然后shell脚本本身我将一个bash变量传递给PHP脚本。
while read bashvariable
do
php wscript.php "$bashvariable"
done
Keep in mind when I run this this shell script manually the script executes and fires correctly. 请记住,当我手动运行此shell脚本时,脚本会正确执行并触发。
At the top of wscript.php I have placed in #!/usr/local/bin/php. 在wscript.php的顶部,我放置了#!/ usr / local / bin / php。
wscript.php has an include file of wscript-add.php wscript.php有一个wscript-add.php的包含文件
I have attempted to change the permission of all files to 777 and I haven't had any luck on getting the cron tab to run correctly. 我试图将所有文件的权限更改为777,我没有任何运气让cron选项卡正确运行。
Below is what my cron tab looks like: 下面是我的cron选项卡的样子:
*/2 * * * * sh /var/www/website/wcron/wcron.sh
My Question: What could cause my PHP file to not fire correctly when used by cron? 我的问题:什么可能导致我的PHP文件在被cron使用时无法正确触发? Do I need specific file permissions on each file to run correctly?
我是否需要对每个文件的特定文件权限才能正确运行?
您需要指定php脚本的完整路径,因为当cron运行时,它使用不同的当前目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.