0

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.

  • Does /etc/init.d/Program_X.sh both work when run directly ? – dev93 Jun 20 at 9:54
  • Yes, both work. However, I have to run them as sudo – Ricard Molins Jun 20 at 10:02
  • I wonder if the disown is 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 ? – dev93 Jun 20 at 10:06
  • I have removed disown and only run Program_B (removing everthing related to program_A). Program_B is still not working, However, there is a proces with the name Program_B. I have update the question with more info on NOTE 3 – Ricard Molins Jun 20 at 10:28
  • if Program_B is showing in ps -aux then 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 the sudo in the init.d file. I think it runs automatically as root – dev93 Jun 20 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.