FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
792 views 2 comments
by
Hi,

Is there a way i can do an automatic check to see what devices are online on the network from the router? I can ping them manually but would like to automate the process. i have seen the user scripts but assume these can only be done on startup.

Regards,

Stephen

1 Answer

+1 vote
by anonymous

Hello,

You can achieve your desired automatic pinging to other network devices only using user scripts. But it is not true that they can be only run one time on startup. You can rerun your script using crontab functionality:

  • Log in to the router using SSH client;
  • Use command crontab -e;
  • Add additional line to crontab, for example: ***** /root/test.sh

In this example script named test.sh that is in the root directory will run every single minute.

Crontab syntax explanation:

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │                                   7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>
by
Thanks,

So next questions are:

a: so i would need a seperate line in the script for each device i wanted to ping?

b. does it have to be done from the SSH client or could it just be uploaded via the web interface?

c. where would the results go? could i view them from the system log?

This is all a bit new so still getting my head around it.

Thanks,

Stephen
by anonymous
a. It depends on how you are going to write your own script. If one script will be able to ping every of your device then one crontab line will be enough. Crontab basically just runs your script from a specific folder in a set period of time.

b. It can be done using SSH or CLI interfaces only.

c. You can write a crontab line so that it will save the output to a file. I suggest using this tool to generate correct crontab syntax: https://crontab-generator.org/