Debug general information

I would like to know if I am unable to ssh to a router with openwrt installed or to connect via an http or https connection which commands to save to debug the problem and find a possible solution.

I currently have a hardware button configured to execute a script in the hope that hardware-wise it will still execute.

it could be useful to save the files on a usb storage, but I thought that if there are problems accessing the storage the files would not be written, so I opted for writing on the internal flash

I know that the best solution would be a serial access to the device but I'm not that good

post the script that can be freely modified or reused if it can be useful to someone else.

#!/bin/sh

if [ -f /root/config/network ]; then
if [ ! -d /root/fail ]; then
mkdir /root/fail
fi
now=$(date +"%d_%m_%Y_%s")
cat /proc/net/arp > /root/fail/arp-${now}
dmesg > /root/fail/dmesg-${now}
logread > /root/fail/logread-${now}
cp /etc/config/network /root/fail/network-${now}
cp /root/config/network /etc/config/network
/etc/init.d/network restart
ip neigh flush all
fi

I’d start be reviewing the config to find out if there are any obvious issues they should be fixed. Then, I’d look at the symptoms overall and the circumstances and patterns before worrying about starting to execute some script on the device.

Do you mean /etc/config/network?

1 Like

i copied the file /etc/config/network into /root/config/network

if I press the button it runs the script and returns me to a working file /etc/config/network

people are stupid and sometimes they make mistakes (I definitely am)

in the hypothesis that I do something stupid I would like to know why it didn't work,

but if I can't access the router in any way I wouldn't know to diagnose what went wrong

and that's why of this general question

first of all thanks to psherman for replying so quickly

and I thank in advance any post you want to send me

I know I should study before doing some things, but my stupidity takes over

1 Like