I have a script that I want to run during my next system boot, but not on subsequent boots. I want to use systemd to launch it, so I created a service file at /usr/lib/systemd/system/myscript.service
:
[Unit]
Description=My script.
[Service]
Type=oneshot
ExecStart=/opt/mypackage/bin/myscript
[Install]
WantedBy=multi-user.target
I can tell systemd to run this service at boot using systemctl enable myscript.service
.
What do I need to do in order to stop it from running on subsequent boots?
I can add systemctl disable myscript.service
to the end of my script, but then that always disables the service. If possible I would like to be able to enable the service, then start it, and still have it execute on next boot.