I am trying to launch an application via inittab in an embedded system. The desire to do this via inittab rather than through an init.d script is to avail of respawn. There is no systemd on this system. I have the following entry in inittab: myapp::respawn:/path/to/my/app
.
Try what I may, it does not start. Per this answer I have observed the following (launching manually):
sh -c /path/to/my/app # works
sh -c exec /path/to/my/app # does not work
sh -c 'exec /path/to/my/app' # works
Per this answer the following shell script also works:
#!/bin/sh
exec /path/to/my/app
Currently I start the application via an init.d script thus: su - root -c '/path/to/my/app &'
and it works but this same command does not work either in inittab. My fallback would be to have yet another monitor script launched from init.d that keeps running and re-launches my application if it is not found in ps
output, but it would be much nicer to get the "automatic" respawn facility via inittab.