Supervisord “exit status 1 not expected” running php script

前端 未结 3 1617
长情又很酷
长情又很酷 2021-01-12 04:16

I\'m having issue try to configure supervisor to run a php script. Running supervisor in debug mode gives me this:

2015-03-09 08:53:06,342 INFO supervisord s         


        
3条回答
  •  有刺的猬
    2021-01-12 05:05

    The only way I could reproduce this behaviour with exit code 1 is to use a invalid path to the file. So first please double check if the path is correct. But I think you have done this before.

    I more assume that the file is located under your home directory and the root user is not able access and run it. So I would try to change the location of the script.

    For testing, you can place your script under /tmp/myScript.php:

    cp /home/path/to/script/myScript.php /tmp/myScript.php
    

    and modify your supervisord config like this:

    [program:worker1]
    command=php myScript.php
    directory=/tmp/
    user=root
    autostart=true
    autorestart=true
    stderr_logfile=/var/log/worker1.err.log
    stdout_logfile=/var/log/worker1.out.log
    redirect_stderr=true
    environment=PATH="/usr/bin"
    

    Now supervisored should be able to run your script.

    If this is working, you should check which folder prevent root from accessing the script. This could be caused by an encypted (and mounted) folder (home dir?), or if the location is mounted from else where (samba, nfs ...). To solve the issue you can try to change the user from root to your user (I would not recommend this) or change the project location to another folder, which is not located under your home dir.

提交回复
热议问题