Passing commands from bash into pepwave CLI

I am currently creating a raspberry pi for out of band management as I have seen that sometimes the pepwave will be “offline” on incontrol despite having power and outputting DHCP it just doesnt get a cellular connection (likely due to our sim supplier)
I have made a bash script that allows me to log into a pepwave router through SSH and input the routers password however I was wondering how to pass further CLI commands into the router i.e. usually a reboot of the router will fix the sims getting stuck on obtaining an IP address
After the login however I cant pass any commands from the bash script through to the CLI, is this because it is locked down or because I am not using the correct commands. I have tried expect and echo but had had no luck
any one else know of anything I can try in bash? or would Python be a better shout?

Via bash you can execute the router’s cli commands the following way after installing sshpass:

image

Check your port on System - Admin Security page:

image

To reboot, the command would be like:

sshpass -p admin ssh -p 8822 admin@192.168.5.1 'system reboot'

image

1 Like

Hi aldwinaldin,
I will give this a go and see if i can get it working
Thanks!

Even if you want to expand your functions to Python, IMHO subprocess library would be most simple way to use your bash commands to execute router cli commands:

image

(called the script reboot.py, but didn’t want to reboot my router constantly to test, so changed it to get eventlog :slight_smile: )

1 Like