It's very annoying when you tring to run a long run command at a remote connection host, the command will shutdown after you logout/disconnet the connection, there are 2 simple program can help you with this:

  1. nohup  - run a command immune to hangups, with output to a non-tty

    It's very easy to use this command to run a long-run command after you logout the system, check below for instance:

    "$nohup tar cvf bakcup.tar /home"

    nohup will cretae a nohup.out file to record the standard ouput  log to ensure the command works correct.

    Kindly reminder, when you logout the system and log in again, the command "ps aux | grep nohup" might have no record for this but the nohup.out do keep increasing. You may run a tests for this.
  2. screen - Scree is such a program could help you create another permanet virtual terminal which will never stop untill you ask it to stop.

    This is a terrific program for complicate long-run operation which support interactive operation for the command operation. Check "man screen" for more details. 
 

0 评论: