I’m not a technical guy, but i need help.
I run dietpi on raspberry pi 02w and i use portainer.
I use 2 scripts,
script 1:
#!/bin/bash
# Ping Google
if ! ping -c 1 google.com &> /dev/null; then
# If the ping fails, restart Docker
systemctl restart portainer
fi
script 2:
#!/bin/bash
# Ping Google
ping -c 1 google.com > /dev/null 2>&1
# Check the exit status of the ping command
if [ $? -ne 0 ]; then
# If ping failed, reboot the system
reboot
fi
i created these using ai and placed script in cron minute and script 2nd in hourly cron
Why do you wanna restart when you have no internet connection? Wouldn’t it be better to check why the connection gets lost and fix that, instead of the symptoms!?
Yes, cron can reboot the system. But maybe it’s better to restart docker and not portainer?!
Can you tell more about your actual problem? You loose internet connection from time to time?
It’s always better to use absolute paths in bash scripts, for example:
#!/bin/bash
# Ping Google
/usr/bin/ping -c 1 google.com > /dev/null 2>&1
# Check the exit status of the ping command
if [ $? -ne 0 ]; then
# If ping failed, reboot the system
/usr/sbin/reboot
fi
i seached about disconnection ,came to know raspberry pi will often loose its connection when using wirelessly
after few hours/days , i cant able to ssh into raspberry pi , but its connected to internet , and their is no way to gain acccess except rebooting my router ,after rebooting my router ,i again able to ssh into my pi
path to my script
/etc/cron.minutely/ping1
/etc/cron.hourly/reboot
i will change it to absolute path and change portainer to docker
where do you know this? And if you still have internet access how should ping to google change anything? This should be working if your internet access is fine.
So the wifi monitor is running and you sill lose access.
Also that the DHCP lease is still active but you can not connect vai SSH sounds more like an power issue.
We always recommend to use a powered USB hub / powerd USB to SATA adapter or whatever you are using to connect the SSD to the device.
The USB ports of the RPi are not designed to deliver power to a device, Even the RPi 4 struggles with that (IDK about the RPi 5 tho).
setting overvoltage to 3 seems to be working
im ordering ,raspberry pi usb hub 3 ,but will it able to backfeed power into pi ,or i still need separate power source
The Raspberry Pi USB 3 Hub provides extra connectivity for your devices, extending one USB-A port into four. An optional external USB-C power input supports high-power peripherals.
Power transfer up to 900 mA (4.5 W); optional external USB-C power input provides up to 5V @ 3A for high-power downstream peripherals
So I would use a 15 watt phone charger and connect it to the hub via USB-C to be safe.
thats my plan ,i will order usb hub ,pi official power supply of 3a
i hope i only need 1 power supply and that goes into usb hub ,and hub will provide power to pi ( raspberry pi 0 2w have capability of getting power through data usb port also)
No, the hub will not power the pi.
The pi needs it’s own power supply. The hub can be powered via the pi, but since you have power issues I recommend a 2nd power supply jsut for the hub!