delica
delica

Reputation: 1707

Google Compute Engine start up python script doesn't run at boot

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.

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'
'

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.

Upvotes: 1

Views: 921

Answers (1)

user835611
user835611

Reputation: 2366

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

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 start

Upvotes: 3

Related Questions