简体   繁体   中英

Starter for code in php5

I have a php code phpprog under Linux, which I can start like any other normal code as

php5 phpprog

or

php5 phpprog&

with the latter to have the process run in the background. However, I want to be able to

  1. start this process in the background
  2. stop this process automatically, without search for the PID of the job

To achieve this, I need some other code which I call starter which will start the actual main process like

php5 starter start

and which stops the main process like

php5 starter stop

The name of the actual main program can be hardcoded in starter , and I want to have only one instance of phpprog runing.

Since I am not very experienced in php, I would appreciate some help in how the code starter might look like.

You can write an init script. Which starts your application on system boot. You can also start/stop/restart it.

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM