Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

shell script

Empfohlene Antworten

Veröffentlicht

hallo leute,

ich habe da ein kleines problem beim erstellen eines scripts.

ich habe eine linuxfirewall und ich moechte mir jeden tag das logfile messages auf meinen windowsrechner schicken. es sollte aber nicht das ganze messages file sein, sondern nur die eintraege vom aktuellen tag.

beispiel:

# !/bin/sh

#

cat /var/log/messages |grep "heutiger tag" |mail -s logfile emailadresse

gruss tt

:rolleyes:

ps: ich weiss am einfachsten jeden tag auf der firewall selber nachschauen und nicht auf ein wi.. wiiiii..ndowsrechner schicken

schau dir mal logsurfer

( ftp://ftp.cert.dfn.de/pub/tools/audit/logsurfer/ )

Das wertet dir /var/log/messages aus und das Ergebniss

kannst du dir ja dann zuschicken lassen.

>ps: ich weiss am einfachsten jeden tag auf der firewall

>selber nachschauen und nicht auf ein wi..

>wiiiii..ndowsrechner schicken

stimmt! ;)

Cya

Wie wärs damit:

#/bin/sh

echo -n -e "cat /var/log/messages|grep \042" > /tmp/lala.sh

date +"%b %d">>/tmp/lala.sh

echo -e "\b\042| mail -s Logfile root" >>/tmp/lala.sh

chmod +x /tmp/lala.sh

/tmp/lala.sh

rm /tmp/lala.sh

Das \042 stellt ein Anführungszeichen (octal) dar. Da ich nicht weiß auf welchen System du arbeitest, kann es sein, dass die bei dir woanderst liegen.

Gruß

Hardcoder

Im Logfile steht am Anfang Monat und Tag in der Form

z.B. für Heute:

Nov 30

Das kannst du ermitteln über

date -d yesterday +"%b %d"

(du willst das Script ja erst am Folgetag aufrufen)

Da dieser Text am Anfang steht, gibtst du dem grep noch ein ^ mit auf dem weg.

Also:


#!/bin/sh

MATCH=`date -d yesterday +"%b %d"`

LOG="/var/log/messages"

MAILTO="user@host.de"


grep "^${MATCH}" ${LOG} | mailx -s "Log vom ${MATCH}" ${MAILTO}

exit 0

danke fuer die zahlreiche hilfe,

werde einfach mal alles testen und das mir einfachste aussuchen.

danke nochmals....

:)

gruss tt

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.