Ces scripts sont lancés au démarrage du système et sont responsables de diverses tâches comme, par exemple, monter le système de fichiers en lecture/écriture, activer le swap, régler quelques paramètres systèmes et lancer divers démons dont le système a besoin.
Dans cette section vous avez besoin du paquetage Sysvinit.
cd /etc mkdir rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d init.d rcS.d
Debian/etc/init.d/rc
vers /etc/init.d
/etc/init.d
#!/bin/sh # Begin /etc/init.d/rcS runlevel=S prevlevel=N umask 022 export runlevel prevlevel trap ":" INT QUIT TSTP for i in /etc/rcS.d/S??* do [ ! -f "$i" ] && continue; $i start done # End /etc/init.d/rcS
reboot
reboot
contenant ce qui suit:
#!/bin/sh # Begin /etc/init.d/reboot echo -n "System reboot in progress..." /sbin/reboot -d -f -i # End /etc/init.d/reboot
halt
halt
contenant ce qui suit:
#!/bin/sh # Begin /etc/init.d/halt /sbin/halt -d -f -i -p # End /etc/init.d/halt
mountfs
mountfs
contenant:
#!/bin/sh # Begin /etc/init.d/mountfs check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } echo -n "Remounting root file system in read-write mode..." /bin/mount -n -o remount,rw / check_status > /etc/mtab /bin/mount -f -o remount,rw / echo -n "Mounting proc file system..." /bin/mount proc check_status # End /etc/init.d/mountfs
umountfs
umountfs
contenant ce qui suit:
#!/bin/sh # Begin /etc/init.d/umountfs check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } echo "Deactivating swap..." /bin/swapoff -av check_status echo -n "Unmounting file systems..." /bin/umount -a -r check_status # End /etc/init.d/umountfs
sendsignals
sendsignals
contenant ce qui suit:
#!/bin/sh # Begin /etc/init.d/sendsignals check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } echo -n "Sending all processes the TERM signal..." /sbin/killall5 -15 check_status echo -n "Sending all processes the KILL signal..." /sbin/killall5 -9 check_status
checkroot
/etc/init.d/checkroot
contenant ce qui suit:
#!/bin/sh # Begin /etc/init.d/checkroot echo "Activating swap..." /sbin/swapon -av if [ -f /fastboot ] then echo "Fast boot, no file system check" else /bin/mount -n -o remount,ro / if [ $? = 0 ] then if [ -f /forcecheck ] then force="-f" else force="" fi echo "Checking root file system..." /sbin/fsck $force -a / if [ $? -gt 1 ] then echo echo "fsck failed. Please repair your file system manually by" echo "running fsck without the -a option" echo "Please note that the file system is currently mounted in" echo "read-only mode." echo echo "I will start sulogin now. CTRL+D will reboot your system." /sbin/sulogin /reboot -f fi else echo "Cannot check root file system because it is not mounted in" echo "read-only mode." fi fi # End /etc/init.d/checkroot
sysklogd
/etc/init.d/sysklogd
contenant ce qui suit:
#!/bin/sh # Begin /etc/init.d/sysklogd check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } case "$1" in start) echo -n "Starting system log daemon..." start-stop-daemon -S -q -o -x /usr/sbin/syslogd -- -m 0 check_status echo -n "Starting kernel log daemon..." start-stop-daemon -S -q -o -x /usr/sbin/klogd check_status ;; stop) echo -n "Stopping kernel log daemon..." start-stop-daemon -K -q -o -p /var/run/klogd.pid check_status echo -n "Stopping system log daemon..." start-stop-daemon -K -q -o -p /var/run/syslogd.pid check_status ;; reload) echo -n "Reloading system load daemon configuration file..." start-stop-daemon -K -q -o -s 1 -p /var/run/syslogd.pid check_status ;; restart) echo -n "Stopping kernel log daemon..." start-stop-daemon -K -q -o -p /var/run/klogd.pid check_status echo -n "Stopping system log daemon..." start-stop-daemon -K -q -o -p /var/run/syslogd.pid check_status sleep 1 echo -n "Starting system log daemon..." start-stop-daemon -S -q -o -x /usr/sbin/syslogd -- -m 0 check_status echo -n "Starting kernel log daemon..." start-stop-daemon -S -q -o -x /usr/sbin/klogd check_status ;; *) echo "Usage: $0 {start|stop|reload|restart}" exit 1 ;; esac # End /etc/init.d/sysklogd
chmod 755 rcS reboot halt mountfs umountfs sendsignals checkroot sysklogd cd ../rc0.d ln -s ../init.d/sysklogd K90sysklogd ln -s ../init.d/sendsignals S80sendsignals ln -s ../init.d/umountfs S90umountfs ln -s ../init.d/halt S99halt cd ../rc6.d ln -s ../init.d/sysklogd K90sysklogd ln -s ../init.d/sendsignals S80sendsignals ln -s ../init.d/umountfs S90umountfs ln -s ../init.d/reboot S99reboot cd ../rcS.d ln -s ../init.d/checkroot S05checkroot ln -s ../init.d/mountfs S10mountfs cd /etc/rc2.d ln -s ../init.d/sysklogd S03sysklogd
/etc/fstab
/etc/fstab
contenant ce qui suit :
/dev/<LFS-partition designation> / ext2 defaults 0 1 /dev/<swap-partition designation> none swap sw 0 0 proc /proc proc defaults 0 0