Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #245102

Re: Autostart command after network is available (usbip)

From Christian Britz <cbritz@t-online.de>
Newsgroups linux.debian.user
Subject Re: Autostart command after network is available (usbip)
Date 2022-02-08 17:50 +0100
Message-ID <DOBQJ-r0F-1@gated-at.bofh.it> (permalink)
References <DOzYB-pL9-7@gated-at.bofh.it> <DOAUF-qrc-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2022-02-08 16:46 UTC+0100, Greg Wooledge wrote:
> On Tue, Feb 08, 2022 at 03:46:09PM +0100, Christian Britz wrote:
>> I want to know how I can execute a command as root once after the
>> network is available.
> 
>> Is this to be done via systemd?
> 
> Yes, that's where you should be doing this.

That is what I thought of initially. And I think I am _almost_ there.
The script works, after several hours of trial, errors and your and
Dan's advice, when I manually execute it via systemctl. Start and stop
works.

It still does not work during boot time, though:
Feb 08 17:34:53 amiga5000 usbip[1014]: usbip: error: tcp connect
Feb 08 17:34:53 amiga5000 systemd[1]: Starting usbip client service...
Feb 08 17:34:53 amiga5000 systemd[1]: usbip.service: Main process
exited, code=exited, status=1/FAILURE
Feb 08 17:34:53 amiga5000 systemd[1]: usbip.service: Failed with result
'exit-code'.
Feb 08 17:34:53 amiga5000 systemd[1]: Failed to start usbip client service.

I am almost sure I got the targets wrong. I _am_ actually using
Network-Manager. Here is my service file:

Unit]
Description=usbip client service
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/usbip attach -r raspberrypi -b 1-1.4
RemainAfterExit=true
ExecStop=/usr/sbin/usbip detach -p 00
StandardOutput=journal

[Install]
WantedBy=multiuser.target

> 
> There's one thing in particular that you need to know first, and that's
> how Debian defines interfaces for the purposes of determining that
> "the network is available".  Assuming that you're using
> /etc/network/interfaces (and not Network-Manager or some other thing)
Yes, I need some more help in the context of using Network-Manager.

-- 
http://www.cb-fraggle.de

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Autostart command after network is available (usbip) Christian Britz <cbritz@t-online.de> - 2022-02-08 15:50 +0100
  Re: Autostart command after network is available (usbip) Dan Ritter <dsr@randomstring.org> - 2022-02-08 16:20 +0100
  Re: Autostart command after network is available (usbip) Greg Wooledge <greg@wooledge.org> - 2022-02-08 16:50 +0100
    Re: Autostart command after network is available (usbip) Christian Britz <cbritz@t-online.de> - 2022-02-08 17:50 +0100
      Re: Autostart command after network is available (usbip) Greg Wooledge <greg@wooledge.org> - 2022-02-08 17:50 +0100
        OT: Network-Manager Christian Britz <cbritz@t-online.de> - 2022-02-08 18:00 +0100
      Re: Autostart command after network is available (usbip) Christian Britz <cbritz@t-online.de> - 2022-02-08 17:50 +0100
        Re: Autostart command after network is available (usbip) Andrei POPESCU <andreimpopescu@gmail.com> - 2022-02-09 15:50 +0100
      Re: Autostart command after network is available (usbip) Andy Smith <andy@strugglers.net> - 2022-02-09 07:10 +0100
        Re: Autostart command after network is available (usbip) 황병희 <soyeomul@doraji.xyz> - 2022-02-09 13:00 +0100

csiph-web