I don't know how gcloud executes the start script, but a reasonable assumption is that it runs it using sh
.
Your startup script starts with a comment character. Therefore, the whole line is treated as a comment and nothing gets executed. The #!
would make sense as a pseudo comment as the first line in a script file (which is different from your case), but even then, the mkdir
would have to be in the subsequent line.
However, even removing the #! would not help in your example, for the following reason:
If you run bash foo bar baz
, bash executes the command foo
as bash-script and passes to it the parameters bar
and baz
. In your case, the command is mkdir
, and this is not a bash script, but a binary executable. You would get the error message
mkdir: cannot execute binary file
Therefore, the solution would be to use the -c
option and write
/usr/bin/bash -c 'mkdir -p ~/test'
as "start script". The -c
tells bash to interpret the following argument as a statement to be executed.
BTW: If gcloud really understands the start-script argument as sh
command, you don't need bash at all and can simply use
mkdir -p $HOME/test
Since it is most likely that the start script is executed with the working directory set to what glcoud considers your home, you should be able to do just a
mkdir -p test