I want to run a program on a linux server A. Linux server B can monitor power metric of server A. But in order to get measure for a program running on server A, I need to open the meaurement script on server B at the start of program on server A and end manually it on server B afterwards.
So to summerize, how to ssh into a server to run a program and terminate it afterwards, via script?