Portál AbcLinuxu, 10. května 2025 11:24
Řešení dotazu:
Jak
píše Xerces, řeši se to přidáním řádku
do /etc/fstab
:
tmpfs /tmp tmpfs defaults 0 0
A co se týče init skriptů, tak pokud potřebuješ spustit něco na konci multiuser runlevelu přidej to do skriptu
/etc/rc.local
:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. exit 0
Když chceš spustit svůj skript před nějakým systémovým, tak se nejprve podívej na pořadí spouštění:
$ ls -l /etc/rc2.d/
Kde S
značí start, K
stop, číslo určuje pořadí. Ulož si svůj skript např. do /etc/init.d/muj_skript.sh
, chceš ho spouštět před skripty S20*
, tak zadej příkaz:
# update-rc.d muj_skript.sh defaults 19 Adding system startup for /etc/init.d/muj_skript.sh ... /etc/rc0.d/K19muj_skript.sh -> ../init.d/muj_skript.sh /etc/rc1.d/K19muj_skript.sh -> ../init.d/muj_skript.sh /etc/rc6.d/K19muj_skript.sh -> ../init.d/muj_skript.sh /etc/rc2.d/S19muj_skript.sh -> ../init.d/muj_skript.sh /etc/rc3.d/S19muj_skript.sh -> ../init.d/muj_skript.sh /etc/rc4.d/S19muj_skript.sh -> ../init.d/muj_skript.sh /etc/rc5.d/S19muj_skript.sh -> ../init.d/muj_skript.sh
Pokud budeš chtít spouštění init skriptu odstranit, spusť příkaz:
# update-rc.d -f muj_skript.sh remove Removing any system startup links for /etc/init.d/muj_skript.sh ... /etc/rc0.d/K19muj_skript.sh /etc/rc1.d/K19muj_skript.sh /etc/rc2.d/S19muj_skript.sh /etc/rc3.d/S19muj_skript.sh /etc/rc4.d/S19muj_skript.sh /etc/rc5.d/S19muj_skript.sh /etc/rc6.d/K19muj_skript.sh
Informace jak psát init skripty dle Linux Standart Base: How to LSBize an Init Script.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.