Re: Single-user actions on reboot
- Reply: Jamie Landeg-Jones : "Re: Single-user actions on reboot"
- Reply: Chris : "Re: Single-user actions on reboot"
- Reply: Jason Bacon : "Re: Single-user actions on reboot"
- In reply to: Jason Bacon : "Single-user actions on reboot"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Sep 2023 13:49:17 UTC
On 29/09/23 15:21, Jason Bacon wrote: > > I'm wondering if there's a canonical way to schedule a command to run > automatically during the next boot cycle, but before going multiuser. > > This would be useful, for example, to run certain tunefs commands on /, > which can only be done in single-user mode, on remotely managed systems. > > Running things after going multiuser is easy, of course, but not > sufficient for tunefs commands that cannot be performed on a filesystem > mounted rw. > > Thanks... > AFAIK there is no ready made tool in base (or ports) for that. But ezjail uses this trick with rc scripts (removing itself): https://erdgeist.org/gitweb/ezjail/tree/examples/example/etc/rc.d/ezjail.flavour.example This is effective but requires the disk mounted r/w which maybe is not enough for you. Problem is, without any writable media mounted, how can any script register it has already ran? One idea that comes to mind is adding some hook to the main rc script, before mounting disk r/w, and a second script that removes existing hooks once disks are r/w. -- Guido Falsi <mad@madpilot.net>