aos-r8-omniswitch-crontab-cron-cronjob-reboot
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| aos-r8-omniswitch-crontab-cron-cronjob-reboot [2024/07/19 12:18] – angelegt benny | aos-r8-omniswitch-crontab-cron-cronjob-reboot [2024/07/21 12:33] (aktuell) – [Vorbereitung: cron.cfg] benny | ||
|---|---|---|---|
| Zeile 3: | Zeile 3: | ||
| In seltenen Fällen kann es notwendig sein nach einem Reboot des OmniSwitch eine Route zu entfernen und neu zu konfigurieren um L2GRE Tunneln zu helfen. Dieser Artikel beschreibt exemplarisch, | In seltenen Fällen kann es notwendig sein nach einem Reboot des OmniSwitch eine Route zu entfernen und neu zu konfigurieren um L2GRE Tunneln zu helfen. Dieser Artikel beschreibt exemplarisch, | ||
| - | ===== Konfiguration des Cronjob ===== | + | Dieser Artikel wurde auf folgenden System/AOS getestet: |
| - | <WRAP center round important 60%> | + | |
| - | Ich habe aktuell noch Schwierigkeiten mit dem @reboot. Muss ich bei nächster Gelegenheit prüfen und korrigieren. | + | |
| - | </WRAP> | + | |
| - | + | ||
| - | <WRAP center round tip 60%> | + | |
| - | Es ist wichtig das korrekte " | + | |
| - | </ | + | |
| < | < | ||
| - | -> appmgr start ams cron-app argument '1 @reboot / | + | -> show system |
| + | System: | ||
| + | Description: | ||
| + | Object ID: 1.3.6.1.4.1.6486.801.1.1.2.1.15.1.4, | ||
| + | Up Time: 0 days 0 hours 42 minutes and 52 seconds, | ||
| + | Contact: | ||
| </ | </ | ||
| - | < | + | ===== Vorbereitung der Python-Dateien ===== |
| - | -> vi / | + | |
| - | </ | + | |
| - | Am Ende der Liste folgendes Kommando einfügen. Der Eintrag hinter '' | + | ==== Vorbereitung: |
| - | < | + | |
| - | @reboot / | + | |
| - | </ | + | |
| - | ===== Exemplarisches Python Skript um Route zu entfernen/ hinzuzufügen | + | Diese Datei wird verwendet um aus dem " |
| - | <file python restore-route.py> | + | |
| + | Der Pfad zu dieser Datei muss dieser sein: ''/ | ||
| + | |||
| + | <file python cron-handler.py> | ||
| + | # | ||
| + | import subprocess | ||
| + | |||
| + | # This is a helper script meant to be used with the AOS R8 ams cron-app | ||
| + | |||
| + | # | ||
| + | # Do not modify below this line | ||
| + | # | ||
| + | def aos_context_command(cmd): | ||
| + | subprocess.Popen(cmd, | ||
| + | |||
| + | aos_context_command(' | ||
| + | </ | ||
| + | |||
| + | ==== Vorbereitung: | ||
| + | |||
| + | Diese Datei ist dafür verantwortlich eine statische Route zu entfernen und wieder hinzuzufügen. | ||
| + | |||
| + | Der Pfad zu dieser Datei muss dieser sein: ''/ | ||
| + | |||
| + | <WRAP center round tip 60%> | ||
| + | In dieser Datei müssen Änderungen durchgeführt und auf die persönlichen Bedürfnisse angepasst werden! | ||
| + | </ | ||
| + | |||
| + | <file python restore-route-reboot.py> | ||
| # | # | ||
| import subprocess | import subprocess | ||
| Zeile 32: | Zeile 52: | ||
| # This script removes a route and adds it again to address a timing issue | # This script removes a route and adds it again to address a timing issue | ||
| # for L2GRE tunnels | # for L2GRE tunnels | ||
| + | |||
| + | # The script is only meant to be run via the AOS R8 ams cron-app | ||
| + | # See https:// | ||
| # | # | ||
| - | # Adapt to your needs | + | # Adapt the following |
| # -Benny | # -Benny | ||
| Zeile 49: | Zeile 72: | ||
| # Do not modify below this line | # Do not modify below this line | ||
| # | # | ||
| - | print(" | ||
| subprocess.run([' | subprocess.run([' | ||
| - | print(f" | ||
| subprocess.run([' | subprocess.run([' | ||
| - | print(f"Added route to {destination}/{mask} via {gateway}") | + | </ |
| + | |||
| + | ===== Konfiguration des Cronjob ===== | ||
| + | |||
| + | <WRAP center round tip 60%> | ||
| + | Es ist wichtig das korrekte " | ||
| + | </WRAP> | ||
| + | |||
| + | <WRAP center round important 60%> | ||
| + | Ich habe Schwierigkeiten mit dieser Vorgehensweise festgestellt wenn die cron-app bereits mit einem "argument" | ||
| + | </ | ||
| + | |||
| + | ==== Vorbereitung: | ||
| + | |||
| + | Dieser Eintrag sorgt dafür dass nach einem Neustart des OmniSwitch 30 Sekunden gewartet wird (sleep 30), danach aus dem Linux-Kontext die Python-Datei " | ||
| + | |||
| + | Der Pfad zu dieser Datei muss dieser sein: ''/ | ||
| + | <file bash cron.cfg> | ||
| + | @reboot sleep 30 && python3 / | ||
| </ | </ | ||
aos-r8-omniswitch-crontab-cron-cronjob-reboot.1721391509.txt.gz · Zuletzt geändert: von benny
