How do I add a startup script to an existing VM from the developer console?

前端 未结 3 1839
旧时难觅i
旧时难觅i 2021-02-12 12:50

I have an existing, already configured VM on Google Cloud Platform. It was created without a startup script, but I\'d like to add one now.

How do I add it from the conso

3条回答
  •  灰色年华
    2021-02-12 13:12

    Thanks to mimming's answer, I was looking for this to solve my issue regarding multiple IP, and his answer help me get started and finally solved my problem by add below startup-script when reboot the instance.

    #! /bin/bash
    sleep 60
    /usr/sbin/ip route add default via 10.8.8.1 dev eth1 table rt1
    /usr/sbin/ip rule add from 10.8.8.3/32 table rt1
    /usr/sbin/ip rule add to 10.8.8.3/32 table rt1
    

    remember to add "sleep 60" otherwise it might not working cause the networking not started yet.

提交回复
热议问题