Domanda

I'm trying to automatically start a process when I enter runlevel 1 by init 1. It's a watchdog which has to send a life signal all the time therefore in runlevel 1 too! But when runlevel 1 is entered each process is killed and the system switches to runlevel S. I tried to tell linux to start my process by update-rc.d -f watchdog 99 1 S .. The resulting entries in /etc/rc1.d/ and /etc/rcS.d/ are:

/etc/rc1.d/:

.
.
.
S30killprocs -> ../init.d/killprocs
S90single -> ../init.d/single
S99watchdog -> ../init.d/watchdog
.
.
.

/etc/rcS.d/:

.
.
.
S01glibc.sh -> ../init.d/glibc.sh
S02hostname.sh -> ../init.d/hostname.sh
S99watchdog -> ../init.d/watchdog
.
.
.

A ps ax after runlevel 1 was entered sadfully doesn't return my watchdog process. I have to start it manually.

PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 init [S]
    2 ?        S      0:00 [kthreadd]
    3 ?        S      0:00 [ksoftirqd/0]
    4 ?        S      0:00 [kworker/0:0]
    5 ?        S      0:00 [kworker/u:0]
    6 ?        S      0:00 [rcu_kthread]
    7 ?        S<     0:00 [khelper]
    8 ?        S      0:00 [kworker/u:1]
  104 ?        S      0:00 [sync_supers]
  106 ?        S      0:00 [bdi-default]
  108 ?        S<     0:00 [kblockd]
  119 ?        S      0:00 [khubd]
  219 ?        S      0:00 [kswapd0]
  220 ?        S      0:00 [fsnotify_mark]
  221 ?        S<     0:00 [aio]
  314 ?        S<     0:00 [scsi_tgtd]
  347 ?        S<     0:00 [kpsmoused]
  349 ?        S      0:00 [kworker/0:1]
  366 ?        S      0:00 [w1_bus_master1]
  390 ?        S      0:00 [mmcqd/0]
  395 ?        S      0:00 [jbd2/mmcblk0p2-]
  396 ?        S<     0:00 [ext4-dio-unwrit]
  475 ?        S      0:00 [flush-179:0]
 4532 ttyS0    Ss     0:00 init [S]
 4533 ttyS0    S      0:00 bash
 4536 ttyS0    R+     0:00 ps ax

The system I'm working on is Debian GNU/Linux 5.0 debarm (embedded). Any hints or solution? Thank you.

È stato utile?

Soluzione 2

I solved it by adding following line into /etc/inittab:

~~:S:wait:/etc/init.d/watchdog start
~~:S:wait:/sbin/sulogin

Note: It must be before /sbin/sulogin.

Altri suggerimenti

As said here:

Run Level 1 is known as 'single user' mode. A more apt description would be 'rescue', or 'trouble-shooting' mode. In run level 1, no daemons (services) are started.

You have several options to get around this limitation:

  1. Don't use runlevel 1, this is not what it is meant for
  2. Start the watchdog on login (if this is a valid option), e.g. .bashrc.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top