Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill respawned process by init in linux

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.

like image 568
user2857290 Avatar asked Jan 09 '14 09:01

user2857290


2 Answers

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)

like image 199
leu Avatar answered Sep 21 '22 18:09

leu


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.

like image 24
Oleg Gryb Avatar answered Sep 21 '22 18:09

Oleg Gryb