ACC SHELL

Path : /usr/lib/pm-utils/sleep.d/
File Upload :
Current File : //usr/lib/pm-utils/sleep.d/50rcnetwork

#!/bin/bash
#
# Prevent lease timing out for networks controlled by ifup/ifdown
# bnc#603291
#
# needs bash, because /etc/sysconfig/network/scripts/functions uses stuff
# only bash provides
# otherwise, you'll get this in the log:
# /usr/lib/pm-utils/sleep.d/50rcnetwork suspend suspend:/etc/sysconfig/network/scripts/functions: line 287: syntax error near unexpected token `<'
# /etc/sysconfig/network/scripts/functions: line 287: `   done < <(LC_ALL=POSIX ip -4 address list "$1" 2>/dev/null)'

. "${PM_FUNCTIONS}"

# Sanity checks
[ -x /etc/init.d/network ] || exit $NA
[ -r /etc/sysconfig/network/config ] && . /etc/sysconfig/network/config
[ -r /etc/sysconfig/network/scripts/functions ] && . /etc/sysconfig/network/scripts/functions

command_exists dhcp_clients || exit $NA

# NetworkManager is handled by 55NetworkManager, so skip this script if
# nm is enabled in sysconfig ...
[ x"${NETWORKMANAGER}" -eq x"yes" ] && exit $NA
# ... or if is running
command_exists nm_running && nm_running && exit $NA

case "$1" in
    hibernate|suspend)
        save_state "dhcp_clients" "`dhcp_clients`"
        service network stop-all-dhcp-clients
        ;;
    thaw|resume)
        for interface in `restore_state "dhcp_clients"`; do
            service network restart ${interface}
        done
        ;;
    *) exit $NA
        ;;
esac

ACC SHELL 2018