Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any idea how to run this on Unifi USG? #1

Open
jtbmedia opened this issue Jun 28, 2024 · 7 comments
Open

Any idea how to run this on Unifi USG? #1

jtbmedia opened this issue Jun 28, 2024 · 7 comments

Comments

@jtbmedia
Copy link

Hi,

Any idea how i can run this on a Unifi USG? Would be great to do that.

@carlbomsdata
Copy link
Owner

Hi,
Unfortunately i dont have a Unifi USG to test with. But i found this link: https://community.ui.com/questions/Own-shell-scripts-on-USG/2efd89de-9544-43de-a216-aaca17955ecb

Is it possible to ssh in to it?

When i tested on my Teltonika router i noticed that the devices had limited disk space (not 10mb free). So i could not use the compiled version of this project. Thats why i created the program.sh shell script :)
program.sh unfortunately relies on ping and curl to be installed on the device (the compiled version dont :) )

If you could ssh on to your Unifi USG, could you please try if its possible to run ping and curl commands? eg ping 8.8.8.8 and curl ifconfig.me

@jtbmedia
Copy link
Author

Hi,

I've SSH'ed into a USG-PRO and it is possible to ping and curl ifconfig.me
It returns my WAN-IP.

@carlbomsdata
Copy link
Owner

carlbomsdata commented Jul 17, 2024

It seems promising that ping and curl works via ssh :)

Can you please run echo $0
It will output which shell the USG is using.

Have you tried to run the program.sh file on your USG? If it's not working, can you paste the output (from log file) here?

If it runs fine manually, the last thing is to schedule the script. Normally it would be done via crontab (crontab -e). But when I read the link above, the Unifi USG had some json file instead that needed to be edited.

@jtbmedia
Copy link
Author

Output from echo $0

-vbash

How can i run the script?

@carlbomsdata
Copy link
Owner

carlbomsdata commented Jul 17, 2024

Thanks!

Once you have transferred the program.sh file from this repo to your device you can run ./program.sh --isp "1.1.1.1" --base_url "https://monitoring.example.com/api/push/XXXXXX"

You might have to change the "shebang" in the beginning/top of the file to bin/bash instead of bin/ash

@jtbmedia
Copy link
Author

I don't know how to copy the script. That's the problem haha

@carlbomsdata
Copy link
Owner

carlbomsdata commented Jul 17, 2024

Aha :)
Try:
scp source_file username@destination:/path/to/destination

If you are on windows you can use powershell

Or just create a new file on USG and copy paste the contents of program.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants