"service network restart" -ash: service: not found

On two 19.07.x Openwrt, one can execute "service network restart" fine, but #2 does not recognize it. There's no /etc/sysconfig/network-scripts on either of them. What could cause such a discrepancy? In the absence of this service, how do I restart just the network, without resorting to rebooting the entire device?

/etc/init.d/network restart

3 Likes

What is /etc/sysconfig? Never heard about it.

/etc/init.d/network restart

1 Like

/etc/sysconfig/network-scripts is reportedly the underlying piece for offering "network" service on some flavor's Linux, when I google for "service network restart” -ash: service: not found.

Well, "googling" in forum leads you right to the right answer:

https://forum.openwrt.org/search?q=network%20restart

As far as I know, there has never been /etc/sysconfig in OpenWrt, (at least since 2010 when I started using OpenWrt.) It is apparently part of some Linux variants, but not OpenWrt.

Red Hat Enterprise is one example that has it.

1 Like

/etc/sysconfig/network-scripts is the network configuration directory of RedHat-based Linux distributions and has nothing to do with OpenWrt.

In OpenWrt, service is a function, defined in /etc/profile.

In version 19.07.8 it looks like this:

service() {
        [ -f "/etc/init.d/$1" ] || {
                echo "service "'"'"$1"'"'" not found, the following services are available:"
                ls "/etc/init.d"
                return 1
        }
        /etc/init.d/$@
}

If you want to investigate the problem, compare the /etc/profile files from both devices. Othewise, use the advices in the posts above.

3 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.