wicked, POST_UP_SCRIPT

Dear collegues!

I am trying to setting up custom very simple script in POST_UP_SCRIPT for eth1 interface file “/etc/sysconfig/network/ifcfg-eth1”.

POST_UP_SCRIPT=“compat:suse:/etc/wicked/scripts/test”
or
POST_UP_SCRIPT=“wicked:/etc/wicked/scripts/test”

but when I am trying do “ifdown eth1” then “ifup eth1” or “systemctl restart network.service” nothing happen. Inside script is simple test command “touch file”. Script works manually from shell.
I read wicked documentation, and took a look on some places in web, but without success…
What I do wrong?

Generally I would like to setup “ip route” & “ip rule” and maybe some additional stuff for eth1 when is up.
Its SUSE system.

Thanks in advance!

1 Like

When you select ‘OTHER VERSION’ you should be explicit with posting the distro version you are using.

The man page (man 5 ifcfg) states

   PRE_UP_SCRIPT, POST_UP_SCRIPT, PRE_DOWN_SCRIPT and POST_DOWN_SCRIPT
          Here  you  can  hook  a script (better: an executable) or systemd service name to perform individual actions before/after the interface is set up or before/after the interface is set down by
          specifying the script names in a space separated list.
          Wicked supports multiple schemes for the scripts.
              - systemd:<service.name>" scheme:
                  Permits a service name or template which will be completed with interface name as its argument, e.g.:
                       POST_UP_SCRIPT="systemd:my-eth-post-up.service"
                       POST_UP_SCRIPT="systemd:my-post-up@.service"
                  On pre-up and post-up actions the service is started, on pre-down and post-down the service will be stopped.
                  The service should make use of an device service unit binding BindsTo=sys-subsystem-net-devices-%i.device so it gets stopped, when the device suddenly disappears.  See also man  sys-
                  temd.unit(5).
              - wicked:<script> scheme:
                  Permits to specify a script or script directory either as an absolute path or relative to the /etc/wicked/scripts directory, e.g.:
                       POST_UP_SCRIPT="wicked:post-up"
                       POST_UP_SCRIPT="wicked:post-up/script1"
                       POST_UP_SCRIPT="wicked:/path/to/my-script-or-dir"
                  The script is executed as "$script $action $interface" with the pre-up, post-up, pre-down, post-down actions corresponding with the variable name.
              - compat:suse:<script> scheme:
                  Permits to specify a script or script directory either as an absolute path or relative to the /etc/sysconfig/network/scripts directory, e.g.:
                       POST_UP_SCRIPT="compat:suse:post-up-script1"
                       POST_UP_SCRIPT="compat:suse:/path/to/my-script-or-dir"
                  The script is executed as "$script $interface $interface -o $action" with the pre-up, post-up, pre-down, post-down actions corresponding with the variable name.
          Note: The script scheme must be specified as a safeguard to not execute any old and not-compatible sysconfig ifup scripts (which may depend on different files, internal state, ...). Once the
          script has been adopted, prepend e.g. the "compat:suse:" scheme to activate.

Thanks!

I saw manpages as well. I tried use it both wicked and compat options.
No reaction… even if I putted echo “Hello” into file.

It’s my ifcfg-eth1 file:

BOOTPROTO=‘static’
BROADCAST=’’
ETHTOOL_OPTIONS=’’
IPADDR=‘address/25’
MTU=’’
NAME=‘network’
NETWORK=’’
REMOTE_IPADDR=’’
STARTMODE=‘boot’
POST_UP_SCRIPT=“compat:suse:/etc/wicked/scripts/test”

Eh…

You still did not answer the main question here: What version of openSUSE are you using?

When you fill in OTHER VERSION, the urge to first and foremost tell us which version you use is more important then ever.

So please, do not skip over this!

Sorry, I forgot about it - It’s SLES12 SP4.

In that case you are on the wrong forums. Please go to Rancher Labs , same username/password as here.

Ok… problem has been solved.
It’s a “noob” problem. For someone who could have similar problem - I putted relative path (only filename), not full - so I was thinking that operations on file were related on place of script, not relating to /root path…

Sorry for your time!
Perhaps posting in forum helped me to looked at this from another side.

Regards,
Thanks!

1 Like