I have a program that needs to run on start up. If i run the script from terminal /etc/init.d/Program_B.sh syslog is working fine. However, the program does NOT log into syslog on boot even though it is running. I am using init.d scripts because the virtual machine in my system does not have systemctl. The program is running as I am able to see the process.

ps -aux | grep Program_B                      
root      1905  0.0  0.2   2308   868 ?        S    09:13   0:00 

My setup is as follows:


Where Program_B.sh is:


After creating the init files and copying the executables I have runned

sudo update-rc.d Program_A.sh defaults

In my /etc/syslog-ng/syslog-ng.conf I have set the following lines:

source s_src { unix-dgram("/dev/log"); internal();
                    file("/proc/kmsg" program_override("kernel"));
template t_timestamp {
    template("${R_DATE} ${MSGHDR}${MSG}\n");
destination d_local2 { file("/var/log/Progam_B.log" template(t_timestamp) create-dirs(yes)); };
filter f_local2 { program("Program_B");};
log { source(s_src); filter(f_local2); destination(d_local2); };

What could be breaking the syslog when running from init.d ?

closed as off-topic by Jeff Schaller Jun 23 at 12:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Question is a problem that CAN be reproduced and it was not casued by a typo. – Ricard Molins Jun 25 at 6:09

It was a problem with boot order as Program_A was started before syslog process and therefore could not use the service. The solution is to run this script:

 sudo update-rc.d Program_A.sh start 21 2 3 4 5 . stop 21 0 1 6 .

instead of

 sudo update-rc.d Program_A.sh defaults

update-rc.d creates symbolic links at the diferent runlevels stored in the folders /etc/rc?.d. In theory adding the LSBInit header into it the Program_A.sh should automatically resolve the boot order. However, in the case of my embedded systems this is not the case.

Syslog has a "boot number" of 20, therfore setting my Program_A a boot order higher than that will ensure Program_A is launched after syslog.

Not the answer you're looking for? Browse other questions tagged or ask your own question.