I have two programs that need to run on start up. I am using init.d scripts because the virtual machine in my system does not have systemctl. With my configuration program_A is working but program_B is not. It seems it is started but it is not working properly as it not logging in syslog as expected.
My setup is as follows:
/usr/bin/Program_A
/usr/bin/Program_B
...
/etc/init.d/Program_A.sh
/etc/init.d/Program_B.sh
Where Program_A.sh and Program_B.sh are like
#!/bin/bash
sudo /usr/bin/Program_A &
disown
After creating the init files and copying the executables I have runned
update-rc.d Program_A.sh defaults
update-rc.d Program_B.sh defaults
Note 1: I had to add the "&" and the "disown" in my script because if I didn't the program_A would get stuck and didn't let program_B start
Note 2: Both programs are known to be working if executed as:
sudo /usr/bin/Program_X
Note 3 I have removed the "disown" and only launched program_B. It is still not working. There is a different behaviour between running the script in init.d and how it is launched on startup.
I can check that the program is launched by :
ps -aux | grep Program_B
root 1905 0.0 0.2 2308 868 ? S 09:13 0:00
/usr/bin/Program_B
However, it is not updating a file in syslog. Therefore, it is not running or the program is launched with another name, making the syslog filter not working.
/etc/init.d/Program_X.shboth work when run directly ?disownis not having some border effect. Did you try somehow changing the order of the scripts (run B before A) and see what's going on ?ps -auxthen it's running. Not finding it in the syslog may be an unrelated issue (I mean it's a problem with the progam not doing what it is supposed to do, but it is running). Also I wonder why you added thesudoin theinit.dfile. I think it runs automatically as root