Results 1 to 4 of 4

Thread: Making a job work in background with scp command

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Making a job work in background with scp command

    Hi All

    IN solaries I am trying to copy files with scp command should continue to work in background evenif logout the session.But scp stops copying as soon a I logged out of session .following are the steps I tried.

    1. get the confim PID from prstat or ps
    2.control + z -----stopping job in foregroung(it not kills the process)
    3.bg ----starts the latest stopped process in background
    4.nohup PID ----to cont. copying after session logout

    not used & for putting job in background as scp command asks password later.

    still job fails to copy .Please suggest solution

  2. #2
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,513
    Thanks
    17
    Thanked 804 Times in 511 Posts
    Rep Power
    10

    Default

    • Can you use ssh-keys?
    • Can you ssh ssh-agent?
    • If not, than next tool is called sshpass.
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default nohup

    try this one:
    nohup scp a.bin <dest_host>:/<dest_dir> &


    --j

  4. #4
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    The problem you have is related to TTY requirement, for Centos type:

    yum install screen -y
    screen -S myjob
    bash my.bash
    CTRL + A + D

    close console and go home. Next day type:
    screen -list
    screen -R myjob

    and whoaala you have your session back with SCP finished probably. By the way it is better to use rsync. More info here:

    thetechtavern.com/2012/05/16/linux-how-to-background-a-process-using-screen-command/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. making a file while making 2 directories at the same time?
    By powerpoint in forum Shell scripting
    Replies: 3
    Last Post: 20th October 2011, 08:02 PM
  2. [Solved] Linux / Unix Dialog command change background color
    By timtravlr in forum Shell scripting
    Replies: 1
    Last Post: 1st October 2011, 02:29 PM
  3. Linux / UNIX: Command for making directory as a tar
    By aish in forum Shell scripting
    Replies: 1
    Last Post: 1st August 2011, 05:06 PM
  4. [Solved] Linux only show process running in background
    By lekhrajdeshmukh in forum Shell scripting
    Replies: 5
    Last Post: 18th March 2011, 06:31 PM
  5. Domain making
    By praveenbhavani in forum Linux software
    Replies: 3
    Last Post: 4th January 2010, 12:15 PM

Tags for this Thread

Posting Permissions

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