How to execute script if any interface up?

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

How to execute script if any interface up?

Postby etminsg » Sat Jul 02, 2016 9:16 pm

Hi, I'm new in archlinux. I used centos before. In my centos, it's easy to execute script each time interface up by place an file ifup-eth* or ifup-local to /etc/sysconfig/network-scripts/ but I try to google about that on archlinux but got not luck.
Any advice is welcome.
Thanks and sorry because bad english
etminsg
 
Posts: 2
Joined: Sat Jul 02, 2016 9:10 pm

Re: How to execute script if any interface up?

Postby cmsigler » Sat Jul 02, 2016 11:55 pm

Hi,

I hope this will help. I'm not a systemd expert but am learning.

I've taken this suggestion from an Arch Linux forum posting. I found it via Google. Code:

$this->bbcode_second_pass_code('', '
/etc/systemd/system/interface-up@.service:

[Unit]
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
ExecStart=REPLACE WITH SCRIPT FILENAME OR COMMAND TO RUN

[Install]
WantedBy=multi-user.target

# systemctl daemon-reload
# systemctl enable interface-up@eth0
')
Note that this is similar to dhcpcd@.service, netctl-auto@.service, netctl-ifplugd@.service. If this doesn't work out-of-the-box maybe this will be enough to help you figure out how to get it working. Cheers!

Clemmitt
- Raspberry Pi 3
- Odroid-C2
- Raspberry Pi Zero
cmsigler
 
Posts: 37
Joined: Wed May 25, 2016 6:01 pm

Re: How to execute script if any interface up?

Postby etminsg » Sun Jul 03, 2016 8:42 pm

Thank you so much :D :D
etminsg
 
Posts: 2
Joined: Sat Jul 02, 2016 9:10 pm


Return to ARMv8

Who is online

Users browsing this forum: No registered users and 17 guests