On Fri, Oct 7, 2011 at 7:01 PM, Mirco Tischler <[email protected]> wrote:
> 2011/10/7 Cliff Brake <[email protected]>:
> The problem is, as soon as ifup exits systemd thinks the service is dead and
> calls the ExecStop line, which of cause brings down the interface
> again instantly.
> The solution should be to add RemainAfterExit=yes to your service file.
Thanks, that enables me to now run systemctrl start/stop.
>> Beyond this, it would be nice to somehow trigger on when a USB NIC is
>> installed and automatically run ifup. Any pointers would be
>> appreciated.
> An udev rule which starts a template unit file is probably the right
> thing to do.
> Something like this may do the job:
>
> SUBSYSTEM=="net", KERNEL!="lo", ENV{SYSTEMD_WANTS}="network@$name.service"
>
> and a service file like this:
>
> cat [email protected]:
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=/sbin/ifup %i
> ExecStop=/sbin/ifdown %i
> StandardOutput=syslog+console
I'm still not successfull in getting ifup to run on boot (after the
NIC is detected) or on NIC insertion.
At a high level, how does the communication between udev and systemd work?
>From udev documentation, I find:
ENV{key} Match against a device property value.
And from systemd documentation:
systemd.device: SYSTEMD_WANTS= Adds dependencies of type Wants from
this unit to all listed units. This may be used to activate arbitrary
units, when a specific device becomes available. Note that this and
the other tags are not taken into account unless the device is tagged
with the "systemd" string in the udev database, because otherwise the
device is not exposed as systemd unit.
I'm having trouble connecting all the dots, or figuring out ways to
debug this. Appreciate any additional suggestions or documentation.
Thanks,
Cliff
--
=================
http://bec-systems.com
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel