Hibernate-Standby Resume Script

From MK Wiki EN
Revision as of 17:19, 28 June 2018 by MkWikiEnSysOp (talk | contribs) (6 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This script is being executed after the system wakes up from either standby or hibernate. It restarts network-manager service and therefore is a workaround for a bug in Ubuntu.

Put this script in /usr/lib/pm-utils/sleep.d/96mk (or choose another filename) and mark it executable.

#!/bin/sh

LOGFILE=/var/log/96mk.log
date >> $LOGFILE
echo $1 >> $LOGFILE

case "$1" in
	thaw|resume)
		echo $0 >> $LOGFILE
#		/usr/local/bin/say de 80 "mein meister. was kann ich für dich tun?"
		/usr/bin/service network-manager restart
		echo "finished" >> $LOGFILE
		;;
	*) exit $NA
		;;
esac

exit 0

Credits

Other values despite of "thaw" and "resume" can be "hibernate" if the system is going to be hibernated or "suspend" if the system is going to stand-by.

Yet another interesting directory is /usr/lib/pm-utils/power.d whose scripts are called when the system is powered on or off. The scripts are called with a parameter of "true" if powered on or "false" if powered off.