Skip to content

Commit

Permalink
changed huaweicheck timers
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashoechst committed Feb 20, 2024
1 parent b2069d0 commit 75f7706
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion etc/network/interfaces.d/eth1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
allow-hotplug eth1
iface eth1 inet dhcp
iface eth1 inet static
address 192.168.8.100/24
gateway 192.168.8.1
post-up iptables --table nat --append POSTROUTING --out-interface $IFACE --jump MASQUERADE
post-down iptables --table nat --delete POSTROUTING --out-interface $IFACE --jump MASQUERADE
4 changes: 3 additions & 1 deletion etc/network/interfaces.d/usb0
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
allow-hotplug usb0
iface usb0 inet dhcp
iface usb0 inet static
address 192.168.8.100/24
gateway 192.168.8.1
post-up iptables --table nat --append POSTROUTING --out-interface $IFACE --jump MASQUERADE
post-down iptables --table nat --delete POSTROUTING --out-interface $IFACE --jump MASQUERADE
4 changes: 2 additions & 2 deletions etc/systemd/system/huaweicheck.timer
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Description=test

[Timer]
OnBootSec=60s
OnUnitActiveSec=300s
OnBootSec=1min
OnUnitActiveSec=30min

[Install]
WantedBy=timers.target
4 changes: 2 additions & 2 deletions home/pi/huaweicheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def ping_find_iface(candidates: tuple[str]) -> list[str]:
return [i for i in os.listdir('/sys/class/net/') if i in candidates]


def ping_cmd(ping_target: str = "8.8.8.8", iface_candidates: tuple[str] = ("eth1", "usb0")) -> list[str]:
def ping_cmd(ping_target: str = "8.8.8.8", iface_candidates: tuple[str] = ("eth1", "usb0"), count: int = 10) -> list[str]:
# define basic ping command
cmd = ["ping", ping_target, "-c", "1"]
cmd = ["ping", ping_target, "-c", f"{count}"]

# find huawei ethernet device
ifaces = ping_find_iface(iface_candidates)
Expand Down

0 comments on commit 75f7706

Please sign in to comment.