5

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.

user2857290
  • 79
  • 1
  • 2
  • 7

3 Answers3

7

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)

leu
  • 2,051
  • 2
  • 12
  • 25
  • ok thanks for reply. if we kill the respawned process and modify/comment out that entry in inittab will be just enough for init to not to respawn again. – user2857290 Jan 14 '14 at 11:07
  • 1
    No, the other way around -- first edit inittab, then signal init, then kill the remaining process. – Jon Watte Apr 03 '15 at 04:19
  • there is no /etc/inittab on my Ubuntu, but the config is in /etc/init/proc_name.conf. I've tried to delete it and signal init, but it didn't help. Any other ideas? – Oleg Gryb Sep 14 '15 at 22:53
4

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.

Oleg Gryb
  • 5,122
  • 1
  • 28
  • 40
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.

NiVer
  • 31
  • 2
  • 2
    The question is not on-topic for Stack Overflow as defined in the [help]. Please don't answer such questions; instead, you should flag them for attention and they will be closed or migrated appropriately. – Toby Speight Sep 01 '16 at 11:13
  • Great job discouraging new user. Answered one question in 2016, but now knows to be quiet. Why not commenting below the question? Why at all? The question is still here and this answer is a good one. – papo Dec 20 '20 at 13:51