Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 631 Bytes

custom-boot-script.md

File metadata and controls

43 lines (30 loc) · 631 Bytes

custom boot script

  • edit file /scripts/custom-boot-script
#!/bin/bash

echo "$(date): custom boot" > /root/custom-boot.log

# ...

echo "$(date): more log" >> /root/custom-boot.log
  • make it executable
chmod +x /scripts/custom-boot-script
  • edit unit file /lib/systemd/system/custom-boot.service
[Unit]
Description=Custom boot script service
Requires=docker.service
After=docker.service

[Service]
ExecStart=/scripts/custom-boot-script
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
  • install
systemctl daemon-reload
systemctl enable custom-boot.service