bb-qq / r8152

Synology DSM driver for Realtek RTL8152/RTL8153/RTL8156 based adapters
GNU General Public License v2.0
2.06k stars 184 forks source link

Script to restart/reload the driver if it crashes. #295

Open MilesTEG1 opened 1 year ago

MilesTEG1 commented 1 year ago

Hello I don't know if some are interested in a script that reload or restart the driver if it crashes. But, here the script I wrote for my DS920+ with DSM 7.1.1-42962 Update 4. In order to use the script, I suggest to create 2 tasks in DSM tasks manager :

  1. One launched at every boot/reboot of the NAS
  2. Another launched every 5 or 10 minutes, in order to ensure the driver is working fine

It may be improved, so don't hesitate to propose modifications. Feel free to go to my repository where I'll update the script: https://github.com/MilesTEG1/synology-driver-pkgctl-r8152-restart-reload/blob/main/driver-pkgctl-r8152-restart-reload.sh

DrFrankensteinUK commented 1 year ago

Thanks for this as on my old 1815+ I sometimes get a crash - going to implement it and see how it pans out

MilesTEG1 commented 1 year ago

Thanks for this as on my old 1815+ I sometimes get a crash - going to implement it and see how it pans out

You're welcome 😄 I just add some fixes. See https://github.com/MilesTEG1/synology-driver-pkgctl-r8152-restart-reload/commit/2ef8b367df9785be32d4ef63e133700c6d8e5242

MilesTEG1 commented 1 year ago

Hello I updated my script with some options : gotify notification, check if sudo. Code rewrite.

DrFrankensteinUK commented 1 year ago

Hello I updated my script with some options : gotify notification, check if sudo. Code rewrite.

Nice one, I have had it in place but I have had to order a USB power splitter as my dongles lose power under sustained loads and the script can't recover from that as they just vanish from the system. I will let you know how I get on when it arrives.

MilesTEG1 commented 1 year ago

Hello I updated my script with some options : gotify notification, check if sudo. Code rewrite.

Nice one, I have had it in place but I have had to order a USB power splitter as my dongles lose power under sustained loads and the script can't recover from that as they just vanish from the system. I will let you know how I get on when it arrives.

Ho! That's not a good news... You say that when the loads is to heavy, the connection fails and can't be recovered by restarted ou reloaded the driver ? You're right by ordering a powered usb hub. It may help.

I think my script can only recover a failed driver , not a failed hardware...

And by the way, I see this morning a bug to fix in my script for the gotify notifications. I had an error when I test the hour if it's even or not. Because I send a gotify notification only every 2h, even if the script is launched every 30min.

The error to fix is:

/volume4/docker/_Scripts-DOCKER/driver-pkgctl-r8152-restart-reload.sh: line 170: 09: value too great for base (error token is "09")
MilesTEG1 commented 1 year ago

Found a fix.

https://github.com/MilesTEG1/synology-driver-pkgctl-r8152-restart-reload/blob/75651c89c8b8a22b4b27962e43bdbae7e7b25fd3/driver-pkgctl-r8152-restart-reload.sh#L167

See last commit:

https://github.com/MilesTEG1/synology-driver-pkgctl-r8152-restart-reload/commit/75651c89c8b8a22b4b27962e43bdbae7e7b25fd3

hqvv commented 1 year ago

Great work! Many thanks for sharing, it solved my big problem with 8153 usb network adapter.

brokenalarms commented 4 months ago

thank you for this!