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 suche eine möglichkeit abzufragen, ob ein bestimmtes Programm noch läuft, andernfalls soll es neu gestartet werden.

Wie kann ich sowas anstellen ?

Ich suche eher nen Code, wo ich z.B. als cronjob laufen lassen kann.

Hallo,

Mit

ps -aef | grep programmname

Das Problem dabei ist, dass man auch den grep-Prozess findet. Sofern Du die PID kennst, kannst Du mir "ps -p <pid>" abfragen, ob der Prozess läuft. Unter SuSe gibt es "checkproc", welches anhand des Dateinamens oder der PID den Status abfragt:

/sbin/checkproc /bin/bash

liefert als Exit-Code 0 sofern eine Bash läuft.

Ansonsten muss Du Dir was mit "ps" und "awk" zusammenbauen:

ps aux | awk '/schnulli/ && !/awk/ {print $2}'

Liefert die PID des Prozesses mit dem Namen "schnulli" (sofern dieser läuft). Je nach Unix-Derivat musst Du ggf. etwas mit den Optionen von ps rumexperimentieren.

Nic

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.