systemd: Convert services (SySv init) to systemctl (systemd) commands
This commit is contained in:
parent
67cf007622
commit
67328ed1a7
@ -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:
|
||||
|
||||
# service bind9 stop
|
||||
# update-rc.d bind9 remove
|
||||
# systemctl stop bind9
|
||||
# systemctl disable bind9
|
||||
# apt-get install dnsmasq
|
||||
|
@ -69,7 +69,7 @@ is_serverip6route_set() {
|
||||
}
|
||||
|
||||
is_openvpn_running() {
|
||||
service openvpn status client &> /dev/null
|
||||
systemctl is-active openvpn@client.service --quiet &> /dev/null
|
||||
}
|
||||
|
||||
is_running() {
|
||||
@ -128,7 +128,7 @@ start_openvpn() {
|
||||
sed 's|^<TPL:LOGIN_COMMENT>||' -i /etc/openvpn/client.conf
|
||||
fi
|
||||
|
||||
service openvpn start client
|
||||
systemctl start openvpn@client.service --quiet
|
||||
}
|
||||
|
||||
## Unsetters
|
||||
@ -146,7 +146,7 @@ unset_serverip6route() {
|
||||
}
|
||||
|
||||
stop_openvpn() {
|
||||
service openvpn stop
|
||||
systemctl stop openvpn.service --quiet
|
||||
}
|
||||
|
||||
## 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)
|
||||
if [ ! -e /tmp/.ynh-vpnclient-boot ]; then
|
||||
touch /tmp/.ynh-vpnclient-boot
|
||||
service php5-fpm restart
|
||||
systemctl restart php5-fpm --quiet
|
||||
fi
|
||||
|
||||
# Check configuration consistency
|
||||
@ -287,12 +287,12 @@ case "${1}" in
|
||||
moulinette_set wired_device "${new_wired_device}"
|
||||
|
||||
# Restart dhcpd
|
||||
service bind9 stop &> /dev/null
|
||||
service dnsmasq restart
|
||||
systemctl stop bind9 --quiet &> /dev/null
|
||||
systemctl restart dnsmasq --quiet
|
||||
|
||||
# Restart hotspot if needed
|
||||
if has_hotspot_app && ! is_hotspot_knowme; then
|
||||
service ynh-hotspot start
|
||||
systemctl start ynh-hotspot --quiet
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@ -322,10 +322,10 @@ case "${1}" in
|
||||
fi
|
||||
|
||||
if has_hotspot_app && is_hotspot_knowme; then
|
||||
service ynh-hotspot start
|
||||
systemctl start ynh-hotspot --quiet
|
||||
fi
|
||||
|
||||
service dnsmasq restart
|
||||
systemctl restart dnsmasq --quiet
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
|
@ -176,9 +176,9 @@ sudo yunohost service enable php5-fpm
|
||||
|
||||
sudo yunohost service add 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
|
||||
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)
|
||||
# A new start will fix the interface without unsetting all stuff
|
||||
if [ -e /tmp/.ynh-hotspot-started ]; then
|
||||
sudo service ynh-hotspot start
|
||||
sudo systemctl restart ynh-hotspot --quiet
|
||||
sudo systemctl restart dnsmasq --quiet
|
||||
fi
|
||||
|
||||
# Check configuration consistency
|
||||
|
@ -21,7 +21,7 @@
|
||||
domain=$(sudo yunohost app setting vpnclient domain)
|
||||
|
||||
# The End
|
||||
sudo service ynh-vpnclient stop
|
||||
sudo systemctl stop ynh-vpnclient --quiet
|
||||
sudo yunohost service remove ynh-vpnclient
|
||||
sudo rm -f /etc/init.d/ynh-vpnclient
|
||||
sudo rm -f /tmp/.ynh-vpnclient-*
|
||||
@ -37,7 +37,7 @@ sudo rm -rf /etc/openvpn/keys/
|
||||
# Restart services
|
||||
sudo yunohost service stop php5-fpm
|
||||
sudo yunohost service start php5-fpm
|
||||
sudo service nginx reload
|
||||
sudo systemctl reload nginx --quiet
|
||||
|
||||
# Remove sources
|
||||
sudo rm -rf /var/www/vpnadmin/
|
||||
|
@ -27,17 +27,17 @@ function moulinette_set($var, $value) {
|
||||
}
|
||||
|
||||
function stop_service() {
|
||||
exec('sudo service ynh-vpnclient stop');
|
||||
exec('sudo systemctl stop ynh-vpnclient');
|
||||
}
|
||||
|
||||
function start_service() {
|
||||
exec('sudo service ynh-vpnclient start', $output, $retcode);
|
||||
exec('sudo systemctl start ynh-vpnclient', $output, $retcode);
|
||||
|
||||
return $retcode;
|
||||
}
|
||||
|
||||
function service_status() {
|
||||
exec('sudo service ynh-vpnclient status', $output);
|
||||
exec('sudo systemctl is-active ynh-vpnclient', $output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user