Re: @reboot

From: Erwan David <erwan_at_rail.eu.org>
Date: Mon, 07 Mar 2022 14:53:02 UTC
Le 23/10/2021 à 16:09, Jos Chrispijn a écrit :
> I have created a script to be runned afte reboot of my server.
> Thing is now that if I stop and start a service, the scripts is ran as 
> well.
> Is there a way of only executing after a total reboot?
> 
> thanks, Jos
> 
> 

You may create a sysemd service unit of type oneshot.

eg. I have something like that (must be adapted to your settings)

[Unit]
Description= A description that you will see in te logs
After=networking.service

[Service]
Type= oneshot
ExecStart=/usr/local/bin/my_script
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target