8
This commit is contained in:
		
							
								
								
									
										131
									
								
								8.html
									
									
									
									
									
								
							
							
						
						
									
										131
									
								
								8.html
									
									
									
									
									
								
							@@ -271,9 +271,9 @@ Alias=sshd.service
 | 
			
		||||
 | 
			
		||||
		        <section>
 | 
			
		||||
		        	<span style="color: orange">Aufgabe:</span> Erstellt eine Unit und startet sie.<p>
 | 
			
		||||
		        		https://wiki.archlinux.org/index.php/Systemd#Writing_unit_files
 | 
			
		||||
		        		
 | 
			
		||||
		        	<div class="fragment">
 | 
			
		||||
		        		<code style="font-size: .5em">/etc/systemd/system/simple-webserver.service</code>
 | 
			
		||||
		        		<code style="font-size: .5em">https://wiki.archlinux.org/index.php/Systemd#Writing_unit_files<br>/etc/systemd/system/simple-webserver.service</code>
 | 
			
		||||
		        		<pre><code>[Unit]
 | 
			
		||||
Description=Simple Web Server
 | 
			
		||||
 | 
			
		||||
@@ -302,7 +302,8 @@ python3 -m http.server 8082 </code></pre>
 | 
			
		||||
	        		<pre><code>journalctl --unit=simple-webserver.service </code></pre>
 | 
			
		||||
	        	</section>
 | 
			
		||||
 | 
			
		||||
	        	<section>Browser öffnen: <code>http://localhost:8082/BENUTZERNAME</code></section>
 | 
			
		||||
	        	<section>Browser öffnen: <code>http://localhost:8082/BENUTZERNAME</code>
 | 
			
		||||
	        		<aside class="notes">der simple webserver ist praktisch zum dateien teilen</aside></section>
 | 
			
		||||
 | 
			
		||||
	        	<section><h4>Ändern der Standard-Units</h4>
 | 
			
		||||
 | 
			
		||||
@@ -327,76 +328,126 @@ python3 -m http.server 8082 </code></pre>
 | 
			
		||||
	        		</aside>
 | 
			
		||||
	        	</section>
 | 
			
		||||
 | 
			
		||||
	        	<section>
 | 
			
		||||
	        		https://wiki.archlinux.org/index.php/Systemd/Timers
 | 
			
		||||
	        		<aside class="notes">üben doku lesen</aside>
 | 
			
		||||
	        	</section>
 | 
			
		||||
	        	
 | 
			
		||||
 | 
			
		||||
	        	<section>
 | 
			
		||||
	        		<span style="color: orange">Aufgabe:</span> Erstellt einen Backup Service, der per systemd Timer einmal wöchentlich läuft.
 | 
			
		||||
	          	<section style="font-size: .7em ">
 | 
			
		||||
	           		<span style="color: orange; ">Aufgabe:</span> Erstellt einen Service, der alle 5 Minuten omikron.net pingt. Die Zeitplanung soll mit systemd timer umgesetzt werden. Die Ausgabe soll nach /var/log/omikron-ping.log geschriebne werden.<p>https://wiki.archlinux.org/index.php/Systemd/Timers
 | 
			
		||||
 | 
			
		||||
	        		<div class="fragment">
 | 
			
		||||
		        		<code style="font-size: .5em">/etc/systemd/system/backup.timer</code>
 | 
			
		||||
		        		<code style="font-size: .5em">/etc/systemd/system/ping-omikron.timer</code>
 | 
			
		||||
		        		<pre><code>	
 | 
			
		||||
[Unit]
 | 
			
		||||
Description=Run backup.sh weekly
 | 
			
		||||
Description=Ping Omikron Timer
 | 
			
		||||
 | 
			
		||||
[Timer]
 | 
			
		||||
OnCalendar=weekly
 | 
			
		||||
OnActiveSec=30s
 | 
			
		||||
OnUnitActiveSec=5m
 | 
			
		||||
Persistent=true
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=timers.target
 | 
			
		||||
WantedBy=basic.target
 | 
			
		||||
						</code></pre>
 | 
			
		||||
					</div>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<code style="font-size: .5em">/etc/systemd/system/backup.service</code>
 | 
			
		||||
					<code style="font-size: .5em">/etc/systemd/system/ping-omikron.service</code>
 | 
			
		||||
	        		<pre><code>	
 | 
			
		||||
[Unit]
 | 
			
		||||
Description=Backup 2000
 | 
			
		||||
Description=Ping Omikron Unit
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=simple
 | 
			
		||||
ExecStart=/home/USERNAME-HIER-EINSETZEN/bin/backup.sh
 | 
			
		||||
ExecStart=/PFAD/ZU/ping-omikron.sh
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
WantedBy=multi-user.target
 | 
			
		||||
					</code></pre>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					<code style="font-size: .5em">~/bin/backup.sh</code>
 | 
			
		||||
					<code style="font-size: .5em">/bin/ping-omikron.sh</code>
 | 
			
		||||
					<pre style="font-size: .4em"><code>#!/bin/bash
 | 
			
		||||
tar -czf "/home/USERNAME/archiv/backup-`date +%d-%m-%Y`.tar.gz" /home/USERNAME/arbeit/
 | 
			
		||||
date &>> /var/log/ping-omikron.log
 | 
			
		||||
ping -c 3 oikron.net &>> /var/log/ping-omikron.log
 | 
			
		||||
					</code></pre>
 | 
			
		||||
	        	</section>
 | 
			
		||||
	        	
 | 
			
		||||
		        <section>
 | 
			
		||||
		          <h4>journalctl</h4>
 | 
			
		||||
		          <pre><code>journalctl</code></pre>
 | 
			
		||||
		          <pre><code>journalctl -xe</code></pre>
 | 
			
		||||
	        		<pre><code>journalctl --unit=backup.service </code></pre>
 | 
			
		||||
				<section>
 | 
			
		||||
					<h4>journalctl</h4>
 | 
			
		||||
					<pre><code>journalctl</code></pre>
 | 
			
		||||
					<pre><code>journalctl -xe</code></pre>
 | 
			
		||||
					<pre><code>journalctl --unit=backup.service </code></pre>
 | 
			
		||||
 | 
			
		||||
		          <aside class="notes">man journalctl</aside>
 | 
			
		||||
		        </section>
 | 
			
		||||
 | 
			
		||||
		        <section>
 | 
			
		||||
		        	timedatectl
 | 
			
		||||
		        	<p>https://wiki.ubuntuusers.de/Systemzeit/
 | 
			
		||||
 | 
			
		||||
		        	<p>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-targets
 | 
			
		||||
					<aside class="notes">man journalctl</aside>
 | 
			
		||||
		        </section>
 | 
			
		||||
				
 | 
			
		||||
				<section><a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-targets">Nützliche sytemd Targets</a>
 | 
			
		||||
					<p>https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-targets</section>
 | 
			
		||||
		        
 | 
			
		||||
		        <section>
 | 
			
		||||
		        	<h4>timedatectl</h4>
 | 
			
		||||
		        	Die Zeit mit systemd einstellen.
 | 
			
		||||
		        	<p>https://wiki.ubuntuusers.de/Systemzeit/
 | 
			
		||||
		        	<pre><code>sudo timedatectl set-timezone Europe/Berlin </code></pre>
 | 
			
		||||
		        	<pre><code>sudo timedatectl set-time 2019-28-02 19:01 </code></pre>
 | 
			
		||||
		        </section>
 | 
			
		||||
 | 
			
		||||
		        <section>
 | 
			
		||||
		        	<h4>Vorteile / Nachteile zu cron:</h4>
 | 
			
		||||
		        	<ul>
 | 
			
		||||
		        		<li class="fragment ">Nachteil: 2 Dateien müssen angelegt werden</li>
 | 
			
		||||
		        		<li class="fragment ">Vorteil: Besser steuerbar, Logs landen im systemd-journal</li>
 | 
			
		||||
		        		<li class="fragment ">Das ist die Zukunft</li>
 | 
			
		||||
		        	</ul>
 | 
			
		||||
		        </section>
 | 
			
		||||
 | 
			
		||||
		        <section style="font-size: .6em">
 | 
			
		||||
		        	<p>Bemerkungen: 
 | 
			
		||||
		        	<p>Systemd ist rückwärtskompatibel zu Sysvinit.<br> Alte init Befehle werden von systemd verstanden, sind teilweise noch in Benutzung
 | 
			
		||||
		        	<p>init-scripte sind in <code>/etc/init.d/</code> zu finden
 | 
			
		||||
		        	<pre><code>sudo /etc/init.d/apache2 start </code></pre>
 | 
			
		||||
		        	<p>Die logs landen weiterhin zusätzlich in /var/log/
 | 
			
		||||
 | 
			
		||||
		        	<p>ein weiteres init-System : Upstart -> eingestellt
 | 
			
		||||
		        		<aside class="notes">
 | 
			
		||||
		        			cat /etc/init.d/apache2<br>
 | 
			
		||||
		        			cat /lib/systemd/system/apache2.service 
 | 
			
		||||
		        		</aside>
 | 
			
		||||
		        </section>
 | 
			
		||||
			
 | 
			
		||||
				<section data-transition="slide" data-background="#4d7e65" data-background-transition="convex">
 | 
			
		||||
					<h2>Part 7 - Startup / Shutdown</h2>
 | 
			
		||||
					<h2>Part 7 - Dateisysteme</h2>
 | 
			
		||||
 | 
			
		||||
				</section>
 | 
			
		||||
				<section>
 | 
			
		||||
					<h4>Benennung von Datenträgern</h4>
 | 
			
		||||
					<p>Festplatten / USB Sticks
 | 
			
		||||
					<ul>
 | 
			
		||||
						<li class="fragment ">/dev/sda - Erste Festplatte</li>
 | 
			
		||||
						<li class="fragment ">/dev/sdb - zweite FP</li>
 | 
			
		||||
						<li class="fragment ">/dev/sda1 - erste Partition auf erster FP</li>
 | 
			
		||||
						<li class="fragment ">/dev/sdb2 - 2.  P. auf 2. FP.</li>
 | 
			
		||||
					</ul>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
				<section>
 | 
			
		||||
					<p>externe Laufwerke
 | 
			
		||||
 | 
			
		||||
					<ul>
 | 
			
		||||
						<li class="fragment ">/dev/scd0 od. /dev/sr0  - erstes CD / DVD Laufwerk</li>
 | 
			
		||||
						<li class="fragment ">/dev/scd1 od. /dev/sr1  - zweites CD / DVD Laufwerk</li>
 | 
			
		||||
					</ul>
 | 
			
		||||
				</section>
 | 
			
		||||
				<section><pre><code>lsblk</code></pre>
 | 
			
		||||
					<pre><code>NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
 | 
			
		||||
sda      8:0    0 489,1G  0 disk 
 | 
			
		||||
├─sda1   8:1    0  63,1G  0 part /
 | 
			
		||||
├─sda2   8:2    0     1K  0 part 
 | 
			
		||||
├─sda5   8:5    0 407,3G  0 part /home
 | 
			
		||||
├─sda6   8:6    0   9,4G  0 part [SWAP]
 | 
			
		||||
└─sda7   8:7    0   9,2G  0 part /tmp
 | 
			
		||||
sdb      8:16   0 298,1G  0 disk 
 | 
			
		||||
└─sdb1   8:17   0 298,1G  0 part /home/dany
 | 
			
		||||
sr0     11:0    1  1024M  0 rom  
 | 
			
		||||
sr1     11:1    1  1024M  0 rom  
 | 
			
		||||
				</code></pre></section>
 | 
			
		||||
 | 
			
		||||
				<section>Reihenfolge kann sich beim Umstecken ändern.<br>For the rescue: UUID
 | 
			
		||||
					<pre><code>ls -Lr /dev/disk/</code></pre></section>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user