I have a startup-script that works well when I launch a compute engine on google cloud. Nevertheless it doesn't seem to execute the following command.
echo ${path} > ~/pd.txt
Actually I can't retrieve my file when I look for it at the indicated path.
Do you have any clue on how I could save a file during startup-script ?
When startup scripts run on GCE, they run under the root
account.
The value of ~
depends on the user. Therefore for startup scripts ~
is /root
. If you login with the user name bob.jones
then ~
is /home/bob.jones
.
You will find the results of echo ${path} > ~/pd.txt
located at /root/pd.txt
A couple of tips with start scripts:
~
. In your example specify the output filename full path.