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.

Shellscript schlägt fehl bei CronJob

Empfohlene Antworten

Veröffentlicht

Hi,

ich hab ein Shellscript das immer nur dann fehlschlägt wenn es per CronJob ausgeführt wird.

Die for-Schleife prüft ob die Devices aus den Parametern auch existiert.


...


for i in $*

do

        fdisk -s ${i} &> /dev/null

        if [ $? -ne 0 ]

        then

                error "${i} not a valid Device!"

        fi

done


...

Bei manuellem Starten gehts einwandfrei.

Betriebssystem ist Redhat AS 4.5.

Grüße

scratch

hi,

bin mir da grade nicht so sicher weil ich bisher immer nur php scripts per cron ausgeführt habe.

Jedoch war bei mir mal der Fehler das die Scripts abgebrochen haben wegen einer Ausgabe, da der Cron nicht wusste wohin damit.

error "${i} not a valid Device!"

was shell/bash angeht bin ich noch nicht so begabt sieht mir aber streng nach einer Ausgabe an. Mal versuche die einfach in /dev/null oder halt in ein log rein zu schreiben.

Hoffe das hilft dir ein bisschen weiter.

Gruss l0rdseth

  • Autor

/home/oracle/backup/vdisk_backup.sh: line 26: fdisk: command not found

ERROR: /dev/sda5 not a valid Device!

Kommt als Fehler ...

Vielleicht muss ich den absoluten Pfad von fdisk angeben ...

  • Autor

Das wars Problem ...

which fdisk
ergab
/sbin/fdisk
dann hab ich das Script angepasst
...


for i in $*

do

        /sbin/fdisk -s ${i} &> /dev/null

        if [ $? -ne 0 ]

        then

                error "${i} not a valid Device!"

        fi

done


...

Und nun gehts auch mit CronJob ;)

Danke!

Grüße

scratch

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.