script to execute after reboot
Andreas Heinlein
aheinlein at gmx.com
Thu Mar 16 20:27:08 CET 2017
Am 14.03.2017 um 15:21 schrieb John G Heim:
> What I do is to run an fai softupdate via a line in cron upon reboot.
>
> @REBOOT root fai --class=POSTINSTALL softupdate
>
> Kind of nice to do an FAI softupdate after every reboot -- especially
> the 1st one after the initial install. Over the years, I've moved more
> and more stuff into the post install softupdate. This has 2 benefits.
> First, the initial install takes only 5 to 10 minutes. Secondly, I can
> almost do a normal install from a CD and do the softupdate and get the
> same results as if I did a fai install in the first place.
> So essentially what I am suggesting is that you run your script after
> every reboot, not just the first one. It can be very convenient to
> have a script that is run after each reboot. Personally, I update that
> script via an fai softupdate. In other words, the softupdate is
> updating the next softupdate. That can get tricky. Make a mistake and
> the softupdates come to a screeching halt. Then you have to figure out
> some way to copy a repaired script to all your fai machines. I did
> that once or twice early on but now I haven't messed it up in years.
>
>
>
>
> On 03/14/2017 07:49 AM, Jan.Dreyer at bertelsmann.de wrote:
>> Hi,
>>
>> I have a script with some commands that should be executed on first
>> reboot after installation only. Now I could put a call to it into
>> rc.local and delete it afterwards, but I’m sure I have seen a more
>> elegant solution directly with FAI. Could someone point my nose to
>> the right direction?
>>
>> Thanks in advance,
>> Jan Dreyer
>>
I have written a startup job for systemd to run scripts in a directory
/etc/runonce.d and then delete the script. It is not very sophisticated
yet, namely it deletes the job no matter whether it exited successfully
or not. I can post it tomorrow, when I'm back at work.
I also run softupdates, but I prefer to run them at shutdown instead of
startup. Running at startup has the advantage that the machine is always
up-to-date (except for kernel updates), including machines which haven't
been powered on for weeks or even months. But it has the disadvantage of
blocking the users' work, something which I absolutely hate about the
way Win* implements its updates.
BTW, this (running jobs once at startup) is something I have been
missing in Linux all these years. Sadly enough, Windows can just do
that. I wish that 'at @reboot...' would work, but it doesn't :-(
Bye,
Andreas
More information about the linux-fai
mailing list