Sieze's Blog

Yet another Java blog

Execute a command via SSH and terminate the connection without waiting for the command to finish

with one comment

A few days ago I was trying to update the script used to build the application on which I’m working. Together with the build I also wanted to integrate the script so to release the app on test boxes and restart the JBoss instance.

While the stop was working as a piece of cake, the restart of the server was keeping my ssh connection alive, and causing the release script to not finish.

After a bit of googling that the ssh syntax you’ll have to use if you want to send a command via ssh, redirect std out/err, and close the ssh connection:

ssh username@host “nohup command_to_execute > /dev/null 2>&1 > /../log_folder/log_file &”

Hope this will help someone of you out there :-)

 

-Sieze

Advertisement

Written by sieze

December 9, 2010 at 10:37 am

Posted in Linux, Ubuntu

Tagged with , , , , , , , , ,

One Response

Subscribe to comments with RSS.

  1. this helped me out a lot, thanks for the tip!

    34sol

    August 15, 2011 at 3:48 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.