Jump to content

Performing a SSH command to a network device on daily basis


Maddeen

Recommended Posts

Hey everybody,

 

hope someone can help me out with this because im not that into SSH stuff.

 

Background: I need to perform the following SSH command to reconnect my UniFi Dream Machine Pro to my local ISP.

This is recommended to make sure that the reconnect will apply on a time no one at my home cares.

 

Due to the fact that this is a UniFi specific problem I searched in the common communities and found that solution

 

Quote

For everyone who does not want to UDM utilities boot script you could schedule the reconnect from a different system via ssh using sshpass. Not pretty, but works for me. I added the following line to my local server to do the reconnect at 3am:

 

Sadly the person - as you can read - uses a tool called SSHPASS and I‘m not aware how to install/use this on unRAID nor - and this is even more interesting - if I need this tool in this case, because maybe unRAID can handle it out of the box? 

 

Here is the command that the person I quoted has stated out.

 

0 3 * * * sshpass -p <MY_UDM_SSH_PASSWORD> ssh -o StrictHostKeyChecking=no root@<MY_UDM_IP>  "killall -HUP pppd"

 

Can anyone help me out here and tell me the best way to achieve my goal?

 

Thanks in advance. Nice easter everybody!

Link to comment

Knowing exactly zero about the tools or devices you are working with i would do the following.

Use the user.scripts plugin to create and schedule the execution of a script. Make that script launch your desired command in a docker container with sshpass installed such as this for example https://hub.docker.com/r/javieraviles/sshpass#! (litterally the first one that came up in a search, not an endorsement of the container).

  • Like 1
Link to comment

Thanks. I’ll try it but I’m pretty sure that I’ll come back and ask for more support 🙈

Hope you’ll have the time for assisting me again. I’m a complete noob when it comes to CMD/scripting stuff. 
 

In the end, my requirement sound easy - just perform a ssh call on a daily basis. But for me it’s mostly rocket science 🙈😜
 

Edited by Maddeen
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...