Ubuntu 15.04 startup & shutdown script (systemd)

  1. Create a custom named file:
    sudo gedit /lib/systemd/system/custom-start-shutdown.service
  2. Copy & paste the following code into the file. Reference the target script files via ExecStart and ExecStop:

    [Unit]
    Description=Custom Start and Shutdown

    [Service]
    Type=oneshot
    ExecStart=/usr/lib/systemd/scripts/custom-start.sh
    ExecStop=/usr/lib/systemd/scripts/custom-shutdown.sh
    RemainAfterExit=yes

    [Install]
    WantedBy=multi-user.target

  3. Enable the service:
    sudo systemctl enable custom-start-shutdown.service

References

SystemdForUpstartUsers – Ubuntu Wiki
systemd – Wikipedia