I definitely think that this is a job for
Big Brother.
rlogin is dirty because it's not encrypted.
ssh is safer and can be used to execute remote commands. But either way, you should use the
Expect module. One of the tutorials in the package actually covers this exact question.
BlueLines
Disclaimer:
This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.