OK, well, the hard work is already done.
@mlord already made the script. You just need to copy the contents.
So, ssh into your router and change directory to somewhere on your jffs partition. Let's assume you are gonna put the script in the /jffs/scripts directory.
mkdir -p /jffs/scripts
cd /jffs/scripts
Use nano to make a new script
nano checkport.sh
Copy the script from above into the new file open. When you are done, ctrl-x will exit nano. It should ask you if you want to save, say yes.
Make the new script executable
chmod +x checkport.sh
Now you can test the script manually. When you notice a port has degraded, ssh into your router and manually run the script;
/jffs/scripts/checkport.sh
and see if you get any errors.
Next step will be to make a cron job. Search the internet for "cron generator" and use any one that suits your fancy to make a cron job for examples on who cron job commands are structured.
Using nano, in the /jffs/scripts directory, edit the file "services-start" with nano, just as above. If services-start does not exits, create it, then in the file put;
Code:
#!/bin/sh
cru a CheckPort */15 * * * * /jffs/scripts/checkport.sh >/dev/null 2>&1
Exit nano and make the file executable
This will run the script every 15 minutes in my example. once the router is rebooted.
You can also add the cron job right away by just entering the cru a command at the command line.