Skip to content

Create a boot script

Matteo Fumagalli edited this page Feb 17, 2018 · 2 revisions

Create a file named mystartup.service at

vi /etc/systemd/system/mystartup.service

[Unit]
Description=myaustart
After=network.target

[Service]
ExecStart=/root/init.sh
Type=oneshot

[Install]
WantedBy=multi-user.target

Now let's create the init.sh script that will be called after boot:

vi ~/init.sh

#!/bin/sh
touch /root/test.txt #create a file test after boot

chmod +x ~/init.sh

systemctl enable mystartup.service