【问题标题】:Azure Linux Web App (startup.sh: not found)Azure Linux Web 应用程序(startup.sh:未找到)
【发布时间】:2019-05-12 13:19:38
【问题描述】:

在 Azure Linux 应用服务上,部署烧瓶应用时出现以下错误:

2019-05-12T13:07:29.931475061Z A P P   S E R V I C E   O N   L I N U X
2019-05-12T13:07:29.931478561Z 
2019-05-12T13:07:29.931481661Z Documentation: http://aka.ms/webapp-linux
2019-05-12T13:07:29.931484961Z 
2019-05-12T13:07:30.016820049Z Starting OpenBSD Secure Shell server: sshd.
2019-05-12T13:07:30.026671394Z Site's appCommandLine: startup.sh
2019-05-12T13:07:30.055028087Z Checking of startup.sh is a file
2019-05-12T13:07:30.082487648Z App command line is a file on disk
2019-05-12T13:07:30.082508249Z App command line is a shell script, will execute this script as startup script
2019-05-12T13:07:30.082513649Z Launching oryx with: -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand startup.sh
2019-05-12T13:07:30.082479048Z Oryx Version : 0.2.20190401.5, Commit: c7bcd3a2b802e109512924fbcf208bf77bf6cc6e
2019-05-12T13:07:30.082553451Z 
2019-05-12T13:07:30.851365669Z Writing output script to '/opt/startup/startup.sh'
2019-05-12T13:07:30.893829956Z Using packages from virtual environment 'antenv' located at '/home/site/wwwroot/antenv'.
2019-05-12T13:07:30.904225020Z /opt/startup/startup.sh: 39: /opt/startup/startup.sh: startup.sh: not found

startup.sh文件在/site/wwwroot,内容如下:

#!/bin/bash
source antenv/bin/activate
gunicorn --bind=0.0.0.0 --timeout 600 app:app

知道是什么导致了这个错误吗?

【问题讨论】:

标签: python linux azure


【解决方案1】:

您应该能够按照以下文档自定义 Python 应用程序命令: https://docs.microsoft.com/en-us/azure/app-service/containers/how-to-configure-python#customize-startup-command

示例(可以在启动命令中添加): gunicorn --bind=0.0.0.0 --timeout 600 hello:myapp

要了解该命令的工作原理,您可以在此处查看 init_container.sh 脚本:https://github.com/Azure-App-Service/python/blob/master/3.7.0/init_container.sh

【讨论】:

    【解决方案2】:

    当文件中的行尾出现问题时,我们也遇到了同样的问题,因为它是在记事本中编辑的。尝试使用 sed 编辑器修复它: sed -i -e 's/\r$//'

    【讨论】:

    • 绝对精彩!我已经为此工作了 3 个小时,没有任何进展。运行上面的一个命令,它就解决了所有问题。太棒了! +1 我的朋友。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    • 2023-03-20
    • 1970-01-01
    相关资源
    最近更新 更多