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.

Empfohlene Antworten

Veröffentlicht

Hallo ich will unter Linux ein kleines Script machen was ein Verzeichnis ausliest und in eine Datei schreibt. Wenn diese Datei dann keinen Inhalt enthält soll nix passieren, ansonsten eine Mail (mit Datei als Anhang) an administrator.

#!/bin/sh

count=0

ls /daten/ | sort > /daten/kfzdaten

if `test = /daten/kfzdaten == 0` ; then

exit

else

mail administrator@testdomain.de + Anhang.....

echo test

exit 0

Wie funktioniert das mit dem if das ich den Inhalt vergleichen kann?

Um zu ueberpruefen oob es ein File ist musst du noch ein -s in die if-Abfrage machen:

if [ -s $file ]

aus der man-Page

-s filename

True if filename exists and has a size greater

than zero.

Könntest Du so erledigen.


#!/bin/bash


DIR=$1

OUTPUT=$2

MAILTO="foo@bar.com"

SUBJECT="Directory Listing of $1"

SIZE=`ls -l $DIR | head -1 | sed -e 's/[a-z]//g'`


if [[ $SIZE -gt 0 ]]

then

        ls -l $DIR > $OUTPUT

        echo "Directory Listing of $1" | /usr/bin/uuenview -b -m $MAILTO -s $SUBJECT -a $OUTPUT

        rm $OUTPUT

fi

Das Skript rufst du dann mit Parametern auf : z.B.

/usr/local/bin/dirlist.sh /daten /tmp/output

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.