How to kill respawned process by init in linux

落花浮王杯 提交于 2019-12-14 03:43:38

问题


am respawning the /bin/bash on ttyS1 port.ttyS0 is my console. inittab entry is given below.

::respawn:/bin/bash < /dev/ttyS1 > /dev/ttyS1 2> /dev/ttyS1

My question is how to disable/kill respwning so that i can use serial port for other application.


回答1:


You can kill that bash process like other processes. However, init respawns it immediately - nothing gained.

To disable the process you have to edit /etc/inittab and comment out that line. To inform init about this change you have to send a SIGHUP to init: kill -HUP pid-of-init. (I think that pid-of-init is always 1).

If you need your bash connected to ttyS1 in some circumstances you may want to specify certain runlevels in which init should start bash.

Hope this answer helps... (see man inittab for further information)




回答2:


On my Ubuntu this is what worked for me:

sudo rm -f /etc/init/<proc_name>.conf
sudo initctl stop <proc_name>

It returned a message:

initctl: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist

but the process was stopped anyway without respawning.




回答3:


inittab have to be reexamine otherwise it will launch the process. Delete the command line link to process on /etc/inittab and execute:

# init q

or

# telinit q

Then , you can kill the process and it will not respawn.



来源:https://stackoverflow.com/questions/21016641/how-to-kill-respawned-process-by-init-in-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!