ajouter un service pour tuer les sessions ssh lors de l'arrêt de la machine

This commit is contained in:
Jephté Clain 2016-12-21 05:08:45 +04:00
parent 4e1e5a44ca
commit c95d1cd39a
4 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,8 @@
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS
run_as_root "$@"
cp "$scriptdir/kill-ssh-user-sessions.service" /etc/systemd/system
systemctl enable kill-ssh-user-sessions.service

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
. "$(dirname "$0")/../../lib/ulib/ulib" || exit 1 source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
check_sysinfos -s linux -d debian || exit 0 check_sysinfos -s linux -d debian || exit 0

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
. "$(dirname "$0")/../../lib/ulib/ulib" || exit 1 source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS urequire DEFAULTS
check_sysinfos -s linux -d debian || exit 0 check_sysinfos -s linux -d debian || exit 0

View File

@ -0,0 +1,11 @@
[Unit]
Description=Shutdown all ssh sessions before network
DefaultDependencies=no
Before=network.target shutdown.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c "/usr/bin/killall sshd;:"
[Install]
WantedBy=poweroff.target halt.target reboot.target