Networking is not made available until all scripts in the /lib/systemd/system-sleep
directory finish executing.
Try sending networking related commands to the background with a delay of e.g. 10 seconds in a sub-shell and detach it i.e. change:
/usr/bin/nmcli c up id "SSID"
to:
(sleep 10; /usr/bin/nmcli c up id "SSID") & disown
Notice that disown
is a bash
builtin and depending on your system shell configuration /bin/sh
might be linked to a different shell command interpreter other than bash
.... For such case, you might call /bin/bash
using a command string like so:
/bin/bash -c '(sleep 10; /usr/bin/nmcli c up id "SSID") & disown'
Or even in most cases calling /bin/sh
with a sub-shell in a command string i.e. like so:
/bin/sh -c '(sleep 10; /usr/bin/nmcli c up id "SSID") &'
should fork a new detached process.
Another thing that you might need to keep that process alive is to explicitly specify/switch to a user e.g. your username
or even root
if your command/script requires elevated privileges to execute ... You can do this as well in a command string style but, you need to use different quoting style i.e. double quotes /bin/su username -c "/bin/bash -c '...'"
e.g. like so:
/bin/su username -c "/bin/bash -c '(sleep 10; /usr/bin/nmcli c up id SSID) & disown'"
changing username
to a valid account's user name on the system e.g. your actual account login user name.