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 hier Lieben,

ich bin neu in Forum und ich hoffe hier könnt mir helfen.

Also ich bin gerade dabei ein Bash Script zu schreiben, habe sehr viel schwierigkeiten weil ich gar keine Ahnung habe was Linux und Scripting habe.

Ich möchste ein if Schleife schreiben, welches Variable prüft ob die 1 oder 0 sind.

Wenn die Variable 0 wieder gibt soll ein Befehl ausgeführt werden und wenn 1 dann ein Befehl ausgeführt werden.

if 

	[ $down == 0 ]


	|| 

		[ $unreachable == 0 ]


	|| 


	[ $critical == 0 ] 


	|| 


		[ $warning == 0 ]  

	then 


	wget --user=user1 --password=123456789 --post-data="p1=0" http://192.168.201.40/cmd.html


	elif 		 	


	[ $down == 1 ] 


	|| 

		[ $unreachable == 1 ]


	|| 


	[ $critical == 1 ] 


	|| 


		[ $warning == 1 ]  

	else 

	wget --user=user1 --password=123456789 --post-data="p1=1" http://192.168.201.40/cmd.html


	fi

 

Ich weiß es gibt hier sehr viele Fehler. Also wenn "$down,"unrechable,$critical und $warning = 0 sind soll ein Befehl aus geführt werden, wen aber die Variable aus 1 sind soll eine andres Befehl ausgeführt werden. Leider verstehe ich den Systax nicht, könnte vielleicht jemand das korrigern und mir erklären was ich falsch mache bitte.

  • Autor

So meine Lösung!

#!/bin/sh

grep -q "down: 0" /var/www/index.html

down=$?

grep -q "unreachable: 0" /var/www/index.html

unreachable=$?

grep -q "critical: 0" /var/www/index.html

critical=$?

grep -q "warning: 0" /var/www/index.html

warning=$?

if

[ $down = 0 -a $unreachable = 0 -a $critical = 0 -a $warning = 0 ];

then

wget --user=user1 --password=123456789 --post-data="p1=0" http://192.168.201.40/cmd.html

else

wget --user=user1 --password=123456789 --post-data="p1=1" http://192.168.201.40/cmd.html

fi

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.