systemd: Convert services (SySv init) to systemctl (systemd) commands
This commit is contained in:
@@ -28,6 +28,6 @@ This app works with a non-stable version of YunoHost.
|
|||||||
|
|
||||||
Until this version is available (coming soon!) as an official stable release, you need to execute some commands before installing this app:
|
Until this version is available (coming soon!) as an official stable release, you need to execute some commands before installing this app:
|
||||||
|
|
||||||
# service bind9 stop
|
# systemctl stop bind9
|
||||||
# update-rc.d bind9 remove
|
# systemctl disable bind9
|
||||||
# apt-get install dnsmasq
|
# apt-get install dnsmasq
|
||||||
|
@@ -69,7 +69,7 @@ is_serverip6route_set() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_openvpn_running() {
|
is_openvpn_running() {
|
||||||
service openvpn status client &> /dev/null
|
systemctl is-active openvpn@client.service --quiet &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
is_running() {
|
is_running() {
|
||||||
@@ -128,7 +128,7 @@ start_openvpn() {
|
|||||||
sed 's|^<TPL:LOGIN_COMMENT>||' -i /etc/openvpn/client.conf
|
sed 's|^<TPL:LOGIN_COMMENT>||' -i /etc/openvpn/client.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
service openvpn start client
|
systemctl start openvpn@client.service --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
## Unsetters
|
## Unsetters
|
||||||
@@ -146,7 +146,7 @@ unset_serverip6route() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop_openvpn() {
|
stop_openvpn() {
|
||||||
service openvpn stop
|
systemctl stop openvpn.service --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
@@ -181,7 +181,7 @@ if [ "$1" != restart ]; then
|
|||||||
# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
|
# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
|
||||||
if [ ! -e /tmp/.ynh-vpnclient-boot ]; then
|
if [ ! -e /tmp/.ynh-vpnclient-boot ]; then
|
||||||
touch /tmp/.ynh-vpnclient-boot
|
touch /tmp/.ynh-vpnclient-boot
|
||||||
service php5-fpm restart
|
systemctl restart php5-fpm --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check configuration consistency
|
# Check configuration consistency
|
||||||
@@ -287,12 +287,12 @@ case "${1}" in
|
|||||||
moulinette_set wired_device "${new_wired_device}"
|
moulinette_set wired_device "${new_wired_device}"
|
||||||
|
|
||||||
# Restart dhcpd
|
# Restart dhcpd
|
||||||
service bind9 stop &> /dev/null
|
systemctl stop bind9 --quiet &> /dev/null
|
||||||
service dnsmasq restart
|
systemctl restart dnsmasq --quiet
|
||||||
|
|
||||||
# Restart hotspot if needed
|
# Restart hotspot if needed
|
||||||
if has_hotspot_app && ! is_hotspot_knowme; then
|
if has_hotspot_app && ! is_hotspot_knowme; then
|
||||||
service ynh-hotspot start
|
systemctl start ynh-hotspot --quiet
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -322,10 +322,10 @@ case "${1}" in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if has_hotspot_app && is_hotspot_knowme; then
|
if has_hotspot_app && is_hotspot_knowme; then
|
||||||
service ynh-hotspot start
|
systemctl start ynh-hotspot --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
service dnsmasq restart
|
systemctl restart dnsmasq --quiet
|
||||||
;;
|
;;
|
||||||
restart)
|
restart)
|
||||||
$0 stop
|
$0 stop
|
||||||
|
@@ -176,9 +176,9 @@ sudo yunohost service enable php5-fpm
|
|||||||
|
|
||||||
sudo yunohost service add ynh-vpnclient
|
sudo yunohost service add ynh-vpnclient
|
||||||
sudo yunohost service enable ynh-vpnclient
|
sudo yunohost service enable ynh-vpnclient
|
||||||
sudo service ynh-vpnclient start
|
sudo systemctl start ynh-vpnclient --quiet
|
||||||
|
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx --quiet
|
||||||
|
|
||||||
# Update SSO for vpnadmin
|
# Update SSO for vpnadmin
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
@@ -186,7 +186,8 @@ sudo yunohost app ssowatconf
|
|||||||
# Restart hotspot service if installed (and started) to change NAT configuration (now on tun0)
|
# Restart hotspot service if installed (and started) to change NAT configuration (now on tun0)
|
||||||
# A new start will fix the interface without unsetting all stuff
|
# A new start will fix the interface without unsetting all stuff
|
||||||
if [ -e /tmp/.ynh-hotspot-started ]; then
|
if [ -e /tmp/.ynh-hotspot-started ]; then
|
||||||
sudo service ynh-hotspot start
|
sudo systemctl restart ynh-hotspot --quiet
|
||||||
|
sudo systemctl restart dnsmasq --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check configuration consistency
|
# Check configuration consistency
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
domain=$(sudo yunohost app setting vpnclient domain)
|
domain=$(sudo yunohost app setting vpnclient domain)
|
||||||
|
|
||||||
# The End
|
# The End
|
||||||
sudo service ynh-vpnclient stop
|
sudo systemctl stop ynh-vpnclient --quiet
|
||||||
sudo yunohost service remove ynh-vpnclient
|
sudo yunohost service remove ynh-vpnclient
|
||||||
sudo rm -f /etc/init.d/ynh-vpnclient
|
sudo rm -f /etc/init.d/ynh-vpnclient
|
||||||
sudo rm -f /tmp/.ynh-vpnclient-*
|
sudo rm -f /tmp/.ynh-vpnclient-*
|
||||||
@@ -37,7 +37,7 @@ sudo rm -rf /etc/openvpn/keys/
|
|||||||
# Restart services
|
# Restart services
|
||||||
sudo yunohost service stop php5-fpm
|
sudo yunohost service stop php5-fpm
|
||||||
sudo yunohost service start php5-fpm
|
sudo yunohost service start php5-fpm
|
||||||
sudo service nginx reload
|
sudo systemctl reload nginx --quiet
|
||||||
|
|
||||||
# Remove sources
|
# Remove sources
|
||||||
sudo rm -rf /var/www/vpnadmin/
|
sudo rm -rf /var/www/vpnadmin/
|
||||||
|
@@ -27,17 +27,17 @@ function moulinette_set($var, $value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stop_service() {
|
function stop_service() {
|
||||||
exec('sudo service ynh-vpnclient stop');
|
exec('sudo systemctl stop ynh-vpnclient');
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_service() {
|
function start_service() {
|
||||||
exec('sudo service ynh-vpnclient start', $output, $retcode);
|
exec('sudo systemctl start ynh-vpnclient', $output, $retcode);
|
||||||
|
|
||||||
return $retcode;
|
return $retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function service_status() {
|
function service_status() {
|
||||||
exec('sudo service ynh-vpnclient status', $output);
|
exec('sudo systemctl is-active ynh-vpnclient', $output);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user