Azure Linux Web App(startup.sh:未找到)

时间:2019-05-12 13:19:39

标签: python linux azure

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

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

关于导致此错误的原因有什么想法?

2 个答案:

答案 0 :(得分:0)

通过遵循以下文档,您应该能够自定义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

答案 1 :(得分:0)

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