<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.defcon-cc.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Mail_bei_dmesg_Output</id>
	<title>Mail bei dmesg Output - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.defcon-cc.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Mail_bei_dmesg_Output"/>
	<link rel="alternate" type="text/html" href="https://www.defcon-cc.org/wiki/index.php?title=Mail_bei_dmesg_Output&amp;action=history"/>
	<updated>2026-04-21T00:56:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.defcon-cc.org/wiki/index.php?title=Mail_bei_dmesg_Output&amp;diff=755&amp;oldid=prev</id>
		<title>Webmaster: Created page with &quot;Manchmal ist es praktisch wenn man bei neuen Kernel-Meldungen informiert wird. Dieses Skript informiert euch per Mail wenn es zu einem neuen Eintrag im dmesg Protokoll gekommen ist.  == Skript == &lt;syntaxhighlight lang=&quot;c&quot;&gt; #!/bin/bash  # Email configuration TO_ADDRESS=&quot;admin@example.com&quot; SUBJECT=&quot;New dmesg Entry Detected for $(hostname)&quot; MAIL_CMD=&quot;/usr/bin/mail&quot; # Make sure the mail command is installed  # Temporary file to store the last state of dmesg DMESG_LAST=&quot;/tmp/...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.defcon-cc.org/wiki/index.php?title=Mail_bei_dmesg_Output&amp;diff=755&amp;oldid=prev"/>
		<updated>2025-02-03T06:20:47Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Manchmal ist es praktisch wenn man bei neuen Kernel-Meldungen informiert wird. Dieses Skript informiert euch per Mail wenn es zu einem neuen Eintrag im dmesg Protokoll gekommen ist.  == Skript == &amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt; #!/bin/bash  # Email configuration TO_ADDRESS=&amp;quot;admin@example.com&amp;quot; SUBJECT=&amp;quot;New dmesg Entry Detected for $(hostname)&amp;quot; MAIL_CMD=&amp;quot;/usr/bin/mail&amp;quot; # Make sure the mail command is installed  # Temporary file to store the last state of dmesg DMESG_LAST=&amp;quot;/tmp/...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Manchmal ist es praktisch wenn man bei neuen Kernel-Meldungen informiert wird. Dieses Skript informiert euch per Mail wenn es zu einem neuen Eintrag im&lt;br /&gt;
dmesg Protokoll gekommen ist.&lt;br /&gt;
&lt;br /&gt;
== Skript ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# Email configuration&lt;br /&gt;
TO_ADDRESS=&amp;quot;admin@example.com&amp;quot;&lt;br /&gt;
SUBJECT=&amp;quot;New dmesg Entry Detected for $(hostname)&amp;quot;&lt;br /&gt;
MAIL_CMD=&amp;quot;/usr/bin/mail&amp;quot; # Make sure the mail command is installed&lt;br /&gt;
&lt;br /&gt;
# Temporary file to store the last state of dmesg&lt;br /&gt;
DMESG_LAST=&amp;quot;/tmp/dmesg_last&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Initialize the dmesg_last file if it doesn&amp;#039;t exist&lt;br /&gt;
if [ ! -f &amp;quot;$DMESG_LAST&amp;quot; ]; then&lt;br /&gt;
    dmesg &amp;gt; &amp;quot;$DMESG_LAST&amp;quot;&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Capture the current state of dmesg&lt;br /&gt;
DMESG_CURRENT=$(dmesg)&lt;br /&gt;
&lt;br /&gt;
# Compare with the last state&lt;br /&gt;
if ! diff &amp;quot;$DMESG_LAST&amp;quot; &amp;lt;(echo &amp;quot;$DMESG_CURRENT&amp;quot;) &amp;gt; /dev/null; then&lt;br /&gt;
    # Get the new entries&lt;br /&gt;
    NEW_ENTRIES=$(diff &amp;quot;$DMESG_LAST&amp;quot; &amp;lt;(echo &amp;quot;$DMESG_CURRENT&amp;quot;) | grep &amp;#039;&amp;gt;&amp;#039; | sed &amp;#039;s/^&amp;gt; //&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
    # Send an email with the new entries&lt;br /&gt;
    echo &amp;quot;$NEW_ENTRIES&amp;quot; | $MAIL_CMD -s &amp;quot;$SUBJECT&amp;quot; &amp;quot;$TO_ADDRESS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # Update the last state&lt;br /&gt;
    echo &amp;quot;$DMESG_CURRENT&amp;quot; &amp;gt; &amp;quot;$DMESG_LAST&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Webmaster</name></author>
	</entry>
</feed>