So, “status” section isn’t working I have tried a lot of modifications, this is just one of them.
Can service watch for “socat” (maybe some “while” loop) instances and respawn them if they dies?
Thanks in advance!
Thanks for answer. But still no joy. Here is a part of my script:
start)
echo -n $"Starting socat services: "
Temp1=/var/run/socat1.pid
FsIn='/usr/bin/socat PTY,link=/dev/ttyS0,raw,echo=0 tcp4:192.168.1.105:7000'
Chk1=$(ps -fe | grep "$FsIn" | head -n1|cut -d" " -f 7)
$FsIn &
echo $Chk1 > $Temp1
# Remember status and be verbose
rc_status -v
;;
I want to save the PID to /var/run/socat1.pid. If I exec it in console line by line, it works well. But when I’ll try to exec the script, then nothing wrote to socat1.pid file.
I have tried inittab, but in some cases it can’t respawn my process. For example, if I unplug network cable from comp and plug in it in 10 seconds. Only “init q” can help me in that case
So you write a wrapper that init calls to detect anomalous conditions and exit so that init can restart it. Maybe even create a watchdog process to monitor the work process. Thing is you end up writing your own respawn loop anyway if you write your own SysV init script instead of using inittab.