linux 系统启动脚本

/etc/init.d/rcS

#! /bin/sh

/bin/mount -a

echo "
            _ _ _ _ _ _ _ _ _ _ _ _
            \  _  _   _  _ _ ___
            / /__/ \ |_/
           / __   /  -  _ ___
          / /  / /  / /
  _ _ _ _/ /  /  \_/  \_ ______
___________\___\__________________
"
for initscript in /etc/init.d/S[0-9][0-9]*
do
        if [ -x $initscript ] ;
        then
                echo "[RCS]: $initscript"
                $initscript
        fi
done

/etc/inittab

# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <[email protected]>
#
# Note: BusyBox init doesn't support runlevels.  The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id        == tty to run on, or empty for /dev/console
# runlevels == ignored
# action    == one of sysinit, respawn, askfirst, wait, and once
# process   == program to run

# Startup the system
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/bin/mkdir -p /dev/pts
null::sysinit:/bin/mkdir -p /dev/shm
null::sysinit:/bin/mount -a
null::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS
ttyS3::respawn:-/sbin/getty -L ttyS3 115200 vt100
# Put a getty on the serial port
#::respawn:-/bin/sh

# ttyUSB0 on usb host.
# ttyUSB0::respawn:-/sbin/getty  115200 ttyUSB0

# ttyGS0 on usb device
# ttyGS0::respawn:-/bin/sh

# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot

# Stuff to do before rebooting
null::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a


# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <[email protected]>
#
# Note: BusyBox init doesn't support runlevels.  The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id        == tty to run on, or empty for /dev/console
# runlevels == ignored
# action    == one of sysinit, respawn, askfirst, wait, and once
# process   == program to run

# Startup the system
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/bin/mkdir -p /dev/pts
null::sysinit:/bin/mkdir -p /dev/shm
null::sysinit:/bin/mount -a
null::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS
#ttyS3::respawn:-/sbin/getty -L ttyS3 115200 vt100
# Put a getty on the serial port
::respawn:-/bin/sh

# ttyUSB0 on usb host.
# ttyUSB0::respawn:-/sbin/getty  115200 ttyUSB0

# ttyGS0 on usb device
# ttyGS0::respawn:-/bin/sh

# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot

# Stuff to do before rebooting
null::shutdown:/etc/init.d/rcK
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a


关闭
#ttyS3::respawn:-/sbin/getty -L ttyS3 115200 vt100
打开
::respawn:-/bin/sh
此时在窗口终端不用输入密码就可以访问文件系统

执行 /bin/mount -a 后 ,系统会找到 /etc/fstab ,然后依次文件挂载

发布了95 篇原创文章 · 获赞 14 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/ding283595861/article/details/104960344