I added a startup-script entry in the metadatas of my google cloud instance as suggested in the doc here the question Google Compute Engine - Start tmux with startup-script didn't work for me. my startup-script code is:
#! /bin/bash
tmux start-server
tmux new -d -s data_vis_pfs 'pachctl mount /var/data_vis/pfs'
tmux new -d -s data_vis_server 'cd /var/data_vis/server/ && python ./index.py'
tmux new -d -s data_vis_client 'cd /var/data_vis/client/ && npx serve -l 3001 -s build'
I also tried :
#! /bin/bash
tmux start \; \
new -d -s data_vis_pfs 'pachctl mount /var/data_vis/pfs' \; \
new -d -s data_vis_server 'cd /var/data_vis/server/ && python ./index.py' \; \
new -d -s data_vis_client 'cd /var/data_vis/client/ && npx serve -l 3001 -s build'
When I do sudo journalctl -u google-startup-scripts.service
; after the machine boots up I get:
Aug 24 12:20:40 work1-cpu systemd[1]: Starting Google Compute Engine Startup Scripts...
Aug 24 12:20:42 work1-cpu GCEMetadataScripts[506]: 2021/08/24 12:20:42 GCEMetadataScripts: Starting startup scripts (version 20201214.00).
Aug 24 12:20:42 work1-cpu GCEMetadataScripts[506]: 2021/08/24 12:20:42 GCEMetadataScripts: Found startup-script in metadata.
Aug 24 12:20:42 work1-cpu GCEMetadataScripts[506]: 2021/08/24 12:20:42 GCEMetadataScripts: startup-script exit status 0
Aug 24 12:20:42 work1-cpu GCEMetadataScripts[506]: 2021/08/24 12:20:42 GCEMetadataScripts: Finished running startup scripts.
Aug 24 12:20:42 work1-cpu systemd[1]: google-startup-scripts.service: Succeeded.
Aug 24 12:20:42 work1-cpu systemd[1]: Started Google Compute Engine Startup Scripts.
so it's supposed to be a win (status 0)
But my code doesn't seems to be active (the python server is not launched, the front and the pachctl mount neither). A top
command doesn't show them too.
I know I am not supposed to see the sessions as it is ran by root
and I could fix that through Socket but I don't care for the moment: I just need the code to be launched.
Do someone have a clue about what I am missing?