Ubuntu changes to the shutdown of the network connection before the shutdown screen appears

Source: Internet
Author: User
Tags exit locale stop script linux mint linux

Mdm.conf Interface off service configuration

# 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被激活且 (when running at a level that is not shutdown and restart) and (the Dbus service is already started) and (Card0 has already been added or Udev-fallback-graphics service has been shut down), this service starts
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)

Turn off this service when #表示当系统运行在关机, single user, reboot state
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); Todo
If ["$ARG" = "text"]; Then
#plymouth为开机, Shutdown screen Program
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 the existence of various environment scripts and load environment variables
Test-f/etc/profile &&. /etc/profile

Back to the column page: http://www.bianceng.cnhttp://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
#得到当前网络连接 (there may be multiple), turn off
Netlinklist= ' Less/proc/net/if_inet6 | Grep-v Lo | Grep-v Vmnet | awk ' {print $} '
echo "Netlist is $netlinklist" >>/home/xxx/shutdownlog1
For node in $netlinklist
Todo
echo "node is $node" >>/home/xxx/shutdownlog2
/sbin/ifconfig $node Down
Done
#激活desktop-shutdown Event triggers the shutdown screen, note the location of the Desktop-shutdown in the plymouth.conf configuration file below
Initctl Emit Desktop-shutdown
Fi
End Script

Shutdown Screen Configuration script:
# plymouth-userspace Bootsplash Utility
#
# Plymouth provides a boot splash screen on the system console using
# The Kernel framebuffer device. On boot, which 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))

#此任务调用fork成为一个进程进行处理
Expect fork
#upstart对此服务最多等待60秒, over to kill this process
Kill Timeout 60

Script
If ["$RUNLEVEL" = "0"-o "$RUNLEVEL" = "1"-o "$RUNLEVEL" = "6"]; Then
#若是关机, restart, single user running state, the execution of the shutdown screen
EXEC/SBIN/PLYMOUTHD--mode=shutdown
Else
#执行开机画面
EXEC/SBIN/PLYMOUTHD--mode=boot--attach-to-session
Fi
End Script

#当服务启动后, execute the following script
Post-start Script
If ["$RUNLEVEL" = "0"-o "$RUNLEVEL" = "1"-o "$RUNLEVEL" = "6"]; Then
#执行关机动画
Exec/bin/plymouth Show-splash
Fi
End Script

#pre-stop Exec/bin/plymouth quit
Pre-stop Script
Exec/bin/plymouth quit
End Script

Author: csdn Blog Yygydjkthh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.