Server IP : 127.0.0.2 / Your IP : 13.59.210.36 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /etc/acpi/ |
Upload File : |
#!/bin/sh # /etc/acpi/powerbtn.sh # Initiates a shutdown when the power putton has been # pressed. [ -r /usr/share/acpi-support/power-funcs ] && . /usr/share/acpi-support/power-funcs # If logind is running, it already handles power button presses; desktop # environments put inhibitors to logind if they want to handle the key # themselves. if pidof systemd-logind >/dev/null; then exit 0 fi # getXuser gets the X user belonging to the display in $displaynum. # If you want the foreground X user, use getXconsole! getXuser() { user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'` if [ x"$user" = x"" ]; then startx=`pgrep -n startx` if [ x"$startx" != x"" ]; then user=`ps -o user --no-headers $startx` fi fi if [ x"$user" != x"" ]; then userhome=`getent passwd $user | cut -d: -f6` export XAUTHORITY=$userhome/.Xauthority else export XAUTHORITY="" fi export XUSER=$user } # Skip if we just in the middle of resuming. test -f /var/lock/acpisleep && exit 0 # If the current X console user is running a power management daemon that # handles suspend/resume requests, let them handle policy This is effectively # the same as 'acpi-support's '/usr/share/acpi-support/policy-funcs' file. [ -r /usr/share/acpi-support/power-funcs ] && getXconsole PMS="gnome-settings-daemon kpowersave xfce4-power-manager" PMS="$PMS guidance-power-manager.py dalston-power-applet" PMS="$PMS mate-settings-daemon" PMS="$PMS unity-settings-daemon" if pidof -x $PMS > /dev/null; then exit elif test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon; then exit elif test "$XUSER" != "" && test -x /usr/bin/qdbus; then kded4pid=$(pgrep -n -u $XUSER kded4) if test "$kded4pid" != ""; then dbusaddr=$(su - $XUSER -c "grep -z DBUS_SESSION_BUS_ADDRESS /proc/$kded4pid/environ") if test "$dbusaddr" != "" && su - $XUSER -c "export $dbusaddr; qdbus org.kde.kded" | grep -q powerdevil; then exit fi fi fi # If all else failed, just initiate a plain shutdown. /sbin/shutdown -h now "Power button pressed"