Google Compute Engine启动python脚本无法在启动时运行 [英] Google Compute Engine start up python script doesn't run at boot

查看:73
本文介绍了Google Compute Engine启动python脚本无法在启动时运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的Google Compute引擎实例设置一小段启动命令,但是无论执行什么操作都不会执行.

I'm trying to set up a short list of start-up commands for my Google Compute engine instance, but no matter what I do it doesn't execute.

该脚本应该启动守护程序屏幕会话,并在屏幕会话中运行python脚本.

The script is supposed to start a daemon screen session and run a python script inside the screen session.

这在命令提示符下工作正常,但根本不能作为启动脚本执行:

This works fine from the command prompt but does not execute at all as a start-up script:

#! /bin/bash
screen -dmS mhsession && screen -S mhsession -X stuff 'cd stream
python3 streamer.py 'ABCD'
'

更新,从/var/log/syslog输出:

UPDATE, output from /var/log/syslog:

May 16 08:25:27 netherlands startup-script: INFO startup-script: No screen session found.
May 16 08:25:27 netherlands startup-script: INFO startup-script: No screen session found.
May 16 08:25:27 netherlands startup-script: INFO startup-script: Return code 1.
May 16 08:25:27 netherlands startup-script: INFO Finished running startup scripts.

推荐答案

stream 文件夹在哪里?您的启动脚本从/运行,而不是/username /root .

Where is the stream folder? Your start up script is run from /, not /username or /root.

ssh 放入Compute Engine,然后查看/var/log/syslog ,搜索 start startup 查看阻止脚本运行的原因.

ssh into the Compute Engine and have a look at /var/log/syslog, search for start or startup to see what's blocking your script from running.

cat/var/log/syslog |grep开始

这篇关于Google Compute Engine启动python脚本无法在启动时运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆