This is an old revision of the document!
Table of Contents
Übgungsaufgabe 1 (Startskripte):
SLES11SP4:~ # cat /etc/init.d/meinscript
#!/bin/bash
### BEGIN INIT INFO
# Provides: meinscript
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3
# Default-Stop:
# Description: tmpfilecreator
### END INIT INFO
case "$1" in
start)
echo "datei anlegen"
touch /tmp/level3_michael
;;
stop)
echo "datei loeschen"
rm /tmp/level3_michael
;;
esac
Übung 2: chkconfig
SLES11SP4:~ # chkconfig atd
atd off SLES11SP4:~ # chkconfig -a atd atd 0:off 1:off 2:on 3:on 4:off 5:on 6:off
rm S und K script
SLES11SP4:/etc/init.d/rc2.d # chkconfig -l | grep atd
atd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
Stoppe cups und ntp:
SLES11SP4:/etc/init.d/rc2.d # /etc/init.d/cups stop Shutting down cupsd done SLES11SP4:/etc/init.d/rc2.d # /etc/init.d/ntp stop Shutting down network time protocol daemon (NTPD) done
Deaktiviere cups und ntp:
SLES11SP4:/etc/init.d/rc2.d # chkconfig -d cups cups 0:off 1:off 2:off 3:off 4:off 5:off 6:off SLES11SP4:/etc/init.d/rc2.d # chkconfig -d ntp ntp 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Aktiviere Cups für aktuellen Runlevel wieder:
SLES11SP4:/etc/init.d/rc2.d # chkconfig -e cups # BESSER NICHT VERWENDEN
Check:
SLES11SP4:/etc/init.d/rc2.d # chkconfig cups cups on
atd dienst wieder in Standard Runlevel starten:
SLES11SP4:/etc/init.d/rc2.d # chkconfig -d atd atd 0:off 1:off 2:off 3:off 4:off 5:off 6:off SLES11SP4:/etc/init.d/rc2.d # chkconfig -a atd atd 0:off 1:off 2:on 3:on 4:off 5:on 6:off
Übung 3 Eigener Runlevel
96 2016-07-14 11:41:38 cp -P ../rc3.d/* . 99 2016-07-14 11:41:52 chkconfig -l
runlevel 4 eintragen und aktivieren
105 2016-07-14 11:42:18 vi smb 106 2016-07-14 11:43:01 chkconfig -d smb 107 2016-07-14 11:43:04 chkconfig -a smb
postfix aus 4 löschen
108 2016-07-14 11:43:19 cd rc4.d/ 110 2016-07-14 11:43:26 rm *postfix
smb und nmb in 4 aktivieren und in 3 deaktivieren
116 2016-07-14 11:44:21 chkconfig -d nmb smb 117 2016-07-14 11:44:23 chkconfig -a nmb smb
atd in 4 aktivieren
118 2016-07-14 11:44:32 vi atd 119 2016-07-14 11:44:42 chkconfig -d atd 120 2016-07-14 11:44:45 chkconfig -a atd
testen
121 2016-07-14 11:44:55 init 4
/etc/nologin anlegen → keine kann sich mehr anmelden. Test in der Datei wird angezeigt shutdown -k tut so, als würde ein Shutdown durchgeführt werden. :)
!!!! halt, reboot, poweroff, swsusp nicht verwenden.
SLES12:/etc/systemd/system # cat default.target
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version.
[Unit] Description=Graphical Interface Documentation=man:systemd.special(7) Requires=multi-user.target After=multi-user.target Conflicts=rescue.target Wants=display-manager.service AllowIsolate=yes
Standard Targets:
poweroff.target runlevel0.target rescue.target runlevel1.target runlevel2.target multi-user.target runlevel3.target graphical.target runlevel5.target reboot.target runlevel6.target emergency.target
Config: - individuell : /etc/systemd/system/default.target - standard : /usr/lib/systemd/system/default.target
default.target → graphical.target → multi-user.target → basic.target → sysinit.target → “wants”
