Operating System - Linux
1828111 Members
4806 Online
109974 Solutions
New Discussion

Problem with startscript in boot mode

 
SOLVED
Go to solution
MQ'ski
Regular Advisor

Problem with startscript in boot mode

Hello.
I have following problem with starting binary program during boot proces.
Sorry that I can not send detailed information of biary but I will try to describe generally the issue in example:
Prerequisites:
Manually binary should be fired from command line by common user - lets call him user.
So I need to login as root and do:
su - user
nohup /whole/path/to/bin/binary_program &
exit
It works fine. I can logout and binary is run anyway.

I have tried with different configurations and finally I tested manually following setting that works when fired from command line.
So I did:
1. In /sbin/rc4.d/ I created S888binary_program symlink to
/sbin/init.d/binary_program
2.Inside /sbin/init.d/binary_program
I put following two lines:
/usr/bin/su - user -c "/home/user/binary_program.sh " >> /dev/null
exit 0
3.File /home/user/binary_program.sh contains:
nohup /whole/path/to/bin/binary_program &
exit 0

When go to /sbin/rc4.d/ and I run
./S888binary_program
I starts the program as expected.
But after reboot process I can not see it as started.

How I can debug this problem?
Maybe it is related to binary itself?
I will try to examine this with more simple program yet but maybe someone would have an idea what can be wrong.






2 REPLIES 2
Dennis Handly
Acclaimed Contributor
Solution

Re: Problem with startscript in boot mode

Well, did you demonize it?
Can you print the PID when you do nohup? Is there a nohup.out file?
It would help if you didn't send the su - user output to /dev/null.

You may have to use tusc:
nohup tusc -fp -o tusc.out /whole/path/to/bin/binary_program &

MQ'ski
Regular Advisor

Re: Problem with startscript in boot mode

I think the problem was in /etc/inittab
default initdefault was 3 instead of 4.
I will test it now