When iso-ignored
boot mode is configured, complete the following steps
on each appliance that should run commands at boot.
About this task
If you configured the appliance to boot in iso-ignored
mode as documented in
Appliance boot mode configuration, the bootcmd
lines will be
ignored. For each appliance node that should run commands at boot, complete the following steps.
Procedure
-
SSH into the appliance as root.
-
Create the /usr/local/bin/appliance-boot-commands.sh script to be executed
at boot; for example:
cat << EOF > /usr/local/bin/appliance-boot-commands.sh
#!/bin/bash
ip route add 172.27.218.0/24 via 192.168.122.1 dev eth0
ip route add 172.26.203.0/24 via 192.168.122.1 dev eth0
EOF
This step takes the same example, and essentially achieves the same result, as the procedure in
Adding a static route on a virtual machine.
-
Make the script executable by running the following command:
chmod +x /usr/local/bin/appliance-boot-commands.sh
-
Create the following systemd service file
/lib/systemd/system/appliance-boot-commands.service:
cat << EOF > /lib/systemd/system/appliance-boot-commands.service
[Unit]
After=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/appliance-boot-commands.sh
RemainAfterExit=false
StandardOutput=journal
[Install]
WantedBy=multi-user.target
EOF
-
Enable the systemd service by running the following command:
systemctl enable appliance-boot-commands
Upon subsequent boots, the /usr/local/bin/appliance-boot-command.sh
script will
be executed.