Running a command as a background process/service

前端 未结 5 1975
猫巷女王i
猫巷女王i 2021-02-13 03:27

I have a Shell command that I\'d like to run in the background and I\'ve read that this can be done by suffixing an & to the command which causes it to run as a

5条回答
  •  孤街浪徒
    2021-02-13 04:31

    Based on this article:
    http:// felixmilea.com/2014/12/running-bash-commands-background-properly/

    ...another good way is with screen eg:

    screen -d -m -s "my session name" 
    

    from the screen manual:

    -d -m
    Start screen in detached mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts.

    i.e. you can close your terminal, the process will continue running (unlike with &)

    with screen you can also reattach to the session later

提交回复
热议问题