|
mdm.conf 界面关闭服务配置
# mdm - MDM Display Manager
#
# The display manager service manages the X servers running on the
# system, providing login and auto-login services
description "MDM Display Manager"
author "Linux Mint <root@linuxmint.com>"
#表示只有当事件filesystem被激活且(运行在不是关机和重启的运行级别的时候)且(dbus服务已经启动)且(card0已经添加或udev-fallback-graphics服务已经关闭)时,此服务启动
start on ((filesystem
and runlevel [!06]
and started dbus
and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
or stopped udev-fallback-graphics))
or runlevel PREVLEVEL=S)
#表示当系统运行在关机、单用户、重启的状态下时,关闭此服务
stop on runlevel [016]
#以下是注册3个事件到upstart事件驱动中
emits login-session-start
emits desktop-session-start
emits desktop-shutdown
#以下为进行服务启动后的处理过程
script
if [ -n "$UPSTART_EVENTS" ]
then
# Check kernel command-line for inhibitors, unless we are being called
# manually
for ARG in $(cat /proc/cmdline); do
if [ "$ARG" = "text" ]; then
#plymouth为开机、关机画面程序
plymouth quit || :
stop
exit 0
fi
done
if [ -f /etc/X11/default-display-manager ]; then
[ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/mdm" ] || { stop; exit 0; }
else
type lightdm >/dev/null 2>&1 && { stop; exit 0; } || true
fi
if [ "$RUNLEVEL" = S -o "$RUNLEVEL" = 1 ]
then
# Single-user mode
plymouth quit || :
exit 0
fi
fi
//测试各种环境脚本是否存在并载入环境变量
test -f /etc/profile && . /etc/profile
返回栏目页:http://www.bianceng.cn/OS/Linux/
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE LC_MESSAGES LC_ALL
elif [ -r /etc/environment ]; then
. /etc/environment
export LANG LANGUAGE LC_MESSAGES LC_ALL
fi
exec mdm
end script
#以下为停止此服务后需要进行的处理
post-stop script
if [ "$UPSTART_STOP_EVENTS" = runlevel ]; then
#得到当前网络连接(可能存在多个),依次关闭
netlinklist=`less /proc/net/if_inet6 | grep -v lo | grep -v vmnet | awk '{print $6}'`
echo "netlist is $netlinklist" >> /home/xxx/shutdownlog1
for node in $netlinklist
do
echo "node is $node" >> /home/xxx/shutdownlog2
/sbin/ifconfig $node down
done
#激活desktop-shutdown事件,会触发关机画面,注意下面的plymouth.conf配置文件中的desktop-shutdown所在位置
initctl emit desktop-shutdown
fi
end script
关机画面配置脚本:
# plymouth - Userspace bootsplash utility
#
# plymouth provides a boot splash screen on the system console using
# the kernel framebuffer device. On boot, this is nominally started by
# the initramfs so the pre-start script, script and post-start script
# parts are actually not run. These are normally run on shutdown instead.
description "userspace bootsplash utility"
start on (starting mountall
or (runlevel [016]
and (desktop-shutdown
or stopped xdm
or stopped uxlaunch)))
(编辑:佛山站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|