LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2007, 02:45 PM   #1
KenPem
LQ Newbie
 
Registered: Dec 2007
Posts: 10

Rep: Reputation: 0
Question Program doesn't run properly on boot


Hi folks

I have a little project on the go, with a LinkSys NSLU2 "Slug" interacting with the outside world via the Velleman K8055 USB interface board. The code is written in C, and runs as a service. And it's all going really well... except that I can't get the code to run properly on startup.

The code resides at /home/dev/test1/roller1 (binary compiled with gcc)
There is a /opt/etc/init.d/S95roller script which starts /home/dev/test1/roller1
Both files are marked executable and belong to owner root and group root.

If I run the code (even from the script) at the command line, all is fine. But it doesn't run properly at boot. Here's the kicker - it DOES RUN, just not well. "ps" shows me that the service has loaded. And the Slug is pretty unresponsive so its obviously busy with SOMETHING. As soon as I stop the service things return to normal.

I've added debug code to write out a text file of progress... but that only works when I run it from the command line too!

Any ideas?
 
Old 12-19-2007, 06:39 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi,

And welcome to LQ!

And this is just a stab in the dark ... does your program require a pty?

[edit]
Btw, which distro evaluates /opt/etc on start=up?
[/edit]


Cheers,
Tink

P.S.: I've reported your post and suggested it be moved to our programming
forum - I guess you'd get better responses there.

Last edited by Tinkster; 12-19-2007 at 06:41 PM. Reason: [edit]
 
Old 12-20-2007, 02:47 AM   #3
KenPem
LQ Newbie
 
Registered: Dec 2007
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
Hi,

And welcome to LQ!
Why thank you. Nice to be here.

Quote:
Originally Posted by Tinkster View Post
And this is just a stab in the dark ... does your program require a pty?
here's where we exceed the (admittedly very low) limits of my Linux expertise... I don't know. What's a pty?

Quote:
Originally Posted by Tinkster View Post
Btw, which distro evaluates /opt/etc on start=up?
The uNLSUng one, a slim distro.... not sure what it was originally based on. Uses the optware packages.
 
Old 12-20-2007, 02:58 AM   #4
KenPem
LQ Newbie
 
Registered: Dec 2007
Posts: 10

Original Poster
Rep: Reputation: 0
if it helps... the program doesn't interact with the console at all. In fact it runs as a silent service.
 
Old 12-20-2007, 07:00 AM   #5
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
As per Tinkster's post, moved to Programming
 
Old 12-20-2007, 04:19 PM   #6
KenPem
LQ Newbie
 
Registered: Dec 2007
Posts: 10

Original Poster
Rep: Reputation: 0
hmmm in NON-*Nix? This is most certainly a Linux matter, although admittedly not one of the mainstream distros.
 
Old 12-20-2007, 06:55 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
The operative word will be the programming thing, I'd say. And
most people here will be very well versed with Linux/Unix, too,
not many Windows-only coders venture here ;}



Cheers,
Tink
 
Old 12-26-2007, 01:18 PM   #8
KenPem
LQ Newbie
 
Registered: Dec 2007
Posts: 10

Original Poster
Rep: Reputation: 0
Question

OK, interesting!

I changed /opt/etc/init.d/S95roller so that it now reads:
Code:
#!/bin/sh
env > /env.txt
/home/dev/test1/roller1
and when I run /opt/etc/init.d/S95roller manually I get an /env.txt output of:
Code:
USER=root
SSH_CLIENT=192.168.1.100 2462 22
MAIL=/var/mail/root
SHLVL=1
LD_LIBRARY_PATH=/opt/lib:
HOME=/root
SSH_TTY=/dev/ttyp0
LOGNAME=root
_=/opt/etc/init.d/S95roller
TERM=xterm
PATH=/opt/sbin:/opt/bin:/sbin:/bin:/usr/sbin:/usr/bin
SHELL=/bin/sh
PWD=/root
SSH_CONNECTION=192.168.1.100 2462 192.168.1.77 22
but when run on boot, I get only:
Code:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin
PWD=/
so it is clear there is a massive difference...but now I really have NO idea what to do with this. Any assistance much appreciated.
 
Old 12-27-2007, 04:42 PM   #9
KenPem
LQ Newbie
 
Registered: Dec 2007
Posts: 10

Original Poster
Rep: Reputation: 0
More info: atop tells me that the program consumes 4% of the CPU when run manually, and the same when run on boot. Don't know if this helps at all. The Slug definately responds .... sluggishly (!) when the program has run at boot, although I can't see what eating the CPU.

This feels very much like a permissions issue... because there's no user on boot? According to the env output above, anyway. Can I force this to run as a user?
 
  


Reply

Tags
nslu2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a program at boot time crazylegs SUSE / openSUSE 2 12-12-2007 09:08 PM
How can a command/program be run automatically on boot? chuanweizuo Linux - Hardware 1 11-28-2005 10:36 AM
How do i have a program run at boot? ultramancool Linux - Software 4 02-25-2005 07:07 AM
Cannot get NVIDIA-Linux-x86_64-1.0-6629-pkg2.run to run properly doctorwebbox Linux - Hardware 0 02-06-2005 06:18 AM
i want to run a script or program at boot time!! FreakboY Linux - Newbie 9 10-12-2003 08:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration