Can I automate Mobile Terminal?

I'm really lazy, and I have a jailbroken iphone.
So whenever my wifi is going slow or messing up, instead of getting up and unplugging/plugging back in the router, I just ssh into it from mobile terminal and then I reboot it.
But now I'm even lazier. I use shortcuts so I don't even have to type anything. I just click a shortcut for su, then su password, then ssh 192.168.1.1, then my router password, then reboot.

But now I want to be even lazier.
Can I create a script that will achieve all of this so then I only have to run one command from terminal that will do this whole operation for me?
Wouldn't running the one command cause you to actually have to do something? 🙂

Original thread: https://forums.imore.com/threads/can-i-automate-mobile-terminal.292502/