I want to run a command on a ssh-server, but this command is determined by a script on my local machine. How do I do that?
An example for clarity:
I want to write a script here (foo.sh) that takes an argument. If I run ./foo.sh 0
it should somehow send a shutdown signal to the server machine, but if I run ./foo.sh 1
it should send a restart signal.
I know how to manually login via ssh, and I've already set ssh-keys to skip passwords, but I don't know how to automate the procedure with a script.
sudoers
file as a user who can issue a shutdown without a password prompt. Not too hard to implement. – Oli Dec 03 '10 at 15:47