On Sat, Nov 1, 2025 at 2:26 PM Ted Mittelstaedt <[email protected]> wrote:
>
> Here's another discussion with some ideas and a script:
>
> https://unix.stackexchange.com/questions/471824/what-is-the-correct-substitute-for-rc-local-in-systemd-instead-of-re-creating-rc
>
> Ted
>
> -----Original Message-----
> From: PLUG <[email protected]> On Behalf Of Robert Detjens
> Sent: Saturday, November 1, 2025 12:08 PM
> To: Portland Linux/Unix Group <[email protected]>
> Subject: Re: [PLUG] Run on every boot?
>
> > ... I'm looking for some convenient systemd method for running the
> > ethtool command line every time it boots.
> >
> > Anyone happen to have a favorite method, off hand?
>
> This is what systemd `oneshot` services are for! They run one command when 
> they start and stay 'running'. Here's an example unit of what this might look 
> like:
>
> ```
> # /etc/systemd/system/wol-fixer.service
> [Unit]
> Description=WoL fixer
> # require and wait for the network device to be ready; use whatever the 
> network device unit is on your system from `systemctl list-units 
> --type=device` After=sys-subsystem-net-devices-eth0.device
> Requires=sys-subsystem-net-devices-eth0.device
>
> [Service]
> Type=oneshot
> ExecStart=/usr/sbin/ethtool <whatever args>
>
> [Install]
> WantedBy=multi-user.target
> ```
>
> Drop this under /etc/systemd/system/<something>.service and then enable that 
> <something>. You could get fancy with this with systemd template units for 
> multiple interfaces but this will work just fine for a single one.
>
> - Robert
>

If it is idempotent you could put it in crontab and run it every 30 seconds :)

Bill

Reply via email to