Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Mar 2022 15:53:02 +0100
From:      Erwan David <erwan@rail.eu.org>
To:        questions@freebsd.org
Subject:   Re: @reboot
Message-ID:  <9dd74923-d8e7-7093-7b8b-9ee1bbf6a29a@rail.eu.org>
In-Reply-To: <224ff1f8-8ad2-3e5c-f7ed-17805c073ada@cloudzeeland.nl>
References:  <224ff1f8-8ad2-3e5c-f7ed-17805c073ada@cloudzeeland.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9dd74923-d8e7-7093-7b8b-9ee1bbf6a29a>