1

I'm targeting ubuntu 22.04

I know how to use cloud-init to do simple stuff like runcmd and add user using users in the yaml.

I have two scripts that I like to be triggered via systemd

  1. before-shutdown-script.sh : this script is to be triggered before the server is shutdown or before the server goes into reboot. The script's job is to call a webhook so network must at least be working before the script is activated. The webhook is simply to tell a centralized place, hey this server is powering down.

  2. upon-bootup-script.sh : this script is to be triggered when the server is booted up. The script's job is to call a webhook so network must at least be working before the script is activated. The webhook is simply to tell a centralized place, hey this server has just booted up.

I am not confident of how to use systemd and how to use cloud-init to configure this. How should I script the cloud-init yaml?

Kim Stacks
  • 10,202
  • 35
  • 151
  • 282

0 Answers0