Skip to content
Advertisement

how to execute init scripts from the command line using ssh

JavaScript

Above mentioned code works fine and displays all the contents of the test directory folder but this code fails

JavaScript

It does not start the mysql server, I have login in to server and use the same command to start the mysql server

Can any one explain this behaviour ? what I am doing wrong bit puzzled 🙁

Advertisement

Answer

Do something like this:

ssh user@hostname "/etc/init.d/mysql start < /dev/null > /tmp/log 2>&1 &"

ssh needs to use stdin and stdout to interact. This will allow it to do that and redirect the output to somewhere useful.

Advertisement