How to specify the order of startup scripts (CLI)?
Posted
by
bcsteeve
on Ask Ubuntu
See other posts from Ask Ubuntu
or by bcsteeve
Published on 2013-11-09T20:10:22Z
Indexed on
2013/11/09
22:10 UTC
Read the original article
Hit count: 166
Startup really confuses me. It seems various methods for starting things happen in different locations all over the place. But is there a way to define the order they are loaded?
Specifically... I have an issue where Plex Media Server (PMS) can't be discovered by clients if the server's VPN connection is established prior PMS starting. It was driving me nuts, but I discovered that I could solve the problem by shutting down PMS, shutting down the VPN, turning on PMS and then turning on VPN.
I'm not exactly sure how PMS auto-loads itself at startup, but the VPN is something I defined by editing: /etc/network/if-up.d/slickvpn with the following:
#! /bin/bash
REQUIRED_CONNECTION_NAME="Wired connection 1"
VPN_CONNECTION_NAME="myvpn"
activ_con=$(nmcli con status | grep "${REQUIRED_CONNECTION_NAME}")
activ_vpn=$(nmcli con status | grep "${VPN_CONNECTION_NAME}")
if [ "${activ_con}" -a ! "${activ_vpn}" ];
then
nmcli con up id "${VPN_CONNECTION_NAME}"
fi
That's a script I found somewhere (I think on this site) when looking for help autoconnecting a VPN.
So I guess /etc/network/if-up.d/ scripts are initiated prior to the PMS service. How can I flip that? Or other solution?
© Ask Ubuntu or respective owner