I've been trying to find the best way to start a python script on startup of my cloud compute instance. So far, I haven't gotten it to run. The script does run when manually executed on the instance. I did make the file executable.
This is what I have tried so far:
1) Add script directly to metadata with key "startup-script". Script starts with:
#! /usr/bin/python3
Followed by the script contents.
Result: Won't run, doesn't show up in log.
2) Try to execute local script from metadata with key "startup-script":
#! /usr/bin/bash"
/home/dir/scripts/script.py.
Result: Won't run, doesn't show up in log.
3) Point to file located in storage bucket with "startup-script-url".
gs://project.appspot.com/folder/script.py
Result: Won't run, but shows "Found startup script" in log.
I hope anyone has some insights.
