Results 1 to 6 of 6

Thread: Keeping an SSH Command going.

  1. #1
    Join Date
    Feb 2006
    Location
    London UK
    Beans
    441

    Keeping an SSH Command going.

    I have a Raspberry Pi set up for background tasks, one of which is to upload files to dropbox via command line scripts.

    I can easily start this by ssh but would like this to continue when I close the ssh connection.

    Any suggestions how this can be done.

    Geffers

  2. #2
    prodigy_ is offline May the Ubuntu Be With You!
    Join Date
    Mar 2008
    Beans
    1,219

    Re: Keeping an SSH Command going.

    If you just want background tasks append & (after a whitespace) to the command line. If you want tasks to start automatically (at reboot or at predefined time), see:
    Code:
    man 5 crontab

  3. #3
    Join Date
    May 2010
    Location
    uk
    Beans
    9,374
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Keeping an SSH Command going.

    Hi

    You could also look at

    Code:
    screen
    Detach and reattach to the screen session.

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  4. #4
    Join Date
    Nov 2007
    Location
    Wisconsin
    Beans
    1,139

    Re: Keeping an SSH Command going.

    Look into the 'screen' command. I use screen a bit like this on a remote system:

    Code:
    local:~$ ssh remote
    remote:~$ps -e | grep screen
     5366 tty3    00:00:00 screen
    remote:~$ screen -r 5366 [TAB]
    remote:~$ run_new_tasks_within_screen
    remote:~$    [ctrl + A] [ctrl + D] (exit screen)
    [detached from 5366.tty3.remote]
    remote:~$ exit
    local:~$
    Another option is to use Upstart jobs, which don't need ssh to stay live.

    Code:
    local:~$ ssh remote
    remote:~$sudo initctl emit do-the-backup-signal
    [sudo] password for you:
    remote:~$ exit
    local:~$
    Another option is to simply add it to your other weekly cronjobs.
    Last edited by Cheesehead; May 6th, 2013 at 05:42 PM.

  5. #5
    Join Date
    Feb 2006
    Location
    London UK
    Beans
    441

    Re: Keeping an SSH Command going.

    Solved, used tmux.

    Geffers

  6. #6
    Join Date
    Feb 2006
    Location
    London UK
    Beans
    441

    Re: Keeping an SSH Command going.

    Quote Originally Posted by Cheesehead View Post
    Look into the 'screen' command. I use screen a bit like this on a remote system:

    [CODE]local:~$ ssh remote
    remote:~$ps -e | grep screen
    A more in depth search suggested tmux is better than screen, thanks for pointer though, it pushed me in the right direction.

    Geffers

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •