How to stop/disable other services in postinst script

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to stop/disable other services in postinst script

votdev
 
Hello.
 
how can i stop and disable other services in my package postinst script? Currently i'm doing the following:
 
case "$1" in
    configure)
        ####################################################################
        # Set the default settings when the package is installed.
        ####################################################################
        if [ -z "$2" ]; then
            ...
            deb-systemd-helper disable ntp.service || :
            deb-systemd-invoke stop ntp.service || :
            deb-systemd-helper disable smartmontools.service || :
            deb-systemd-invoke stop smartmontools.service || :
            deb-systemd-helper disable proftpd.service || :
            deb-systemd-invoke stop proftpd.service || :
            deb-systemd-helper disable nfs-kernel-server.service || :
            deb-systemd-invoke stop nfs-kernel-server.service || :
            deb-systemd-helper disable nfs-common.service || :
            deb-systemd-invoke stop nfs-common.service || :
            ...
 
The problem is that it does not work. Some (or all, did not have tested that) are still running after the package has been installed.
Do i miss something?
 
Any tip will be helpful. Thanks.
 
Regards
Volker