且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

运行命令作为后台进程/服务

更新时间:2023-02-22 21:28:47

看看在守护的命令,它可以打开任意进程为守护进程。这将使你的脚本作为一个守护进程,而不需要你做很多额外的工作。下一步是在系统启动时自动调用它。要知道正确的方式来做到这一点,你需要提供你的操作系统(或者,对于Linux,您的分布)。

Take a look at the daemon command, which can turn arbitrary processes into daemons. This will allow your script to act as a daemon without requiring you to do a lot of extra work. The next step is to invoke it automatically at boot. To know the correct way to do that, you'll need to provide your OS (or, for Linux, your distribution).