0

I have a instance where I have some Flask web app. In order the app to start when the VM is booted I have included a startup script:

#!/bin/sh
cd documentai_webapp
cd docai_webapp_instance_gcp
sudo python3 server.py

However, this is not at all executed, anyone can help me?thanks!

PD: When I execute this script manually within the VM it works perfectly fine

1
  • 1
    you shouldn't use sudo for python. That being said, you followed this documentation? Commented Sep 13, 2022 at 14:58

1 Answer 1

1

As context it is necessary contemplate:

For Linux startup scripts, you can use bash or non-bash file. To use a non-bash file, designate the interpreter by adding a #! to the top of the file. For example, to use a Python 3 startup script, add #! /usr/bin/python3 to the top of the file.

If you specify a startup script by using one of the procedures in this document, Compute Engine does the following:

Copies the startup script to the VM

Sets run permissions on the startup script

Runs the startup script as the root user when the VM boots (missing step from @Andoni)

For information about the various tasks related to startup scripts and when to perform each one, see the Overview.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.