Running a command as a background process/service

前端 未结 5 1973
猫巷女王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:11

    For advanced job control with bash, you should look into the commands jobs bg and fg.

    However, it seems like you're not really interested in running the command in the background. What you want to do is launch the command at startup. The way to do this varies depending on the Unix system you use, but try to look into the rc family of files (/etc/rc.local for example on Ubuntu). They contain scripts that will be executed after the init script.

提交回复
热议问题