start an application on boot


Forum: Other Help Topics
Topic: start an application on boot
started by: xlancealotx

Posted by xlancealotx on Dec. 11 2007,21:48
ok, never mind the old one's this must be an easy one.

I have DSL4 working and wish to start 2 items, the old machine had an rc.local of;

cd /
perl connextgen.pl >> /var/log/messages 2>&1 &

gflashplayer /main.swf >> /var/log/messages 2>&1 &

I know there is no rc.local, so I assume I should be updating the .xinitrc file.   I commented out the Dillo stuff as I don't need, but tried the above to look similar adding the & but no good.

So how do you kickstart a command line app (well, 2 of them) on boot.

Tnx

Posted by mikshaw on Dec. 11 2007,22:14
putting "cd /" in .xinitrc isn't a good idea. This will cause you to run your desktop from /, which makes a few applications fail to behave as they should. Some programs are configured to use files with a path relative to your home directory.

I can't quite figure out the way you are redirecting output, so for all I know there may be a conflict there. My personal experience has been to use the most minimal format possible. If you're attempting to redirect both stderr and stdout, i think you can rely simply on >> (I'm not certain of this). Also make sure you have write permission to /var/log/messages. DSL does not initially allow a regular user to write to it or read it.

gflashplayer isn't a commandline application, so it must be run from .xinitrc

The perl script depends on whether it's a user app or a system (root) app. If it must be run by root, it should be run from /opt/bootlocal.sh. If run by a regular user, and doesn't require X, put it in /home/dsl/.bash_profile. If it needs X, put it in .xinitrc

Posted by ^thehatsrule^ on Dec. 12 2007,05:36
There are other rc* directories you could also use.  In addition to mikshaw's comment, I'm wondering why you have to files stored on / anyhow... but for now you can just specify the full pathname.

>> appends stdout to a file while 2>&1 redirects stderr to stdout, so in essence both stderr and stdout gets appended to the file.

Posted by mikshaw on Dec. 12 2007,14:26
I guess I follow. The "2>&1" and similar has never looked logical to me, even after reading the abs redirection chapter several times, so it has never sunken in.
In any case, I believe "&>>" is the simplified version I was looking for, not ">>".

Posted by xlancealotx on Dec. 12 2007,15:08
well the cd / and such were what was done in the past, I am not sure why that as well as why everything in the root (maybe for convenience).  Basically these little box's are connected via serial device to a data collection device and uses the perl script to interpret the data and gflashplayer to show it live.

As for the starting, gflashplayer is a command line script as far as I can tell, it's the adobe flash player standalone, but it works w/o a web browser, from a terminal, a simple;
/gflashplayer /main.swf loads the entire monitor with the application.  I am not sure if that means it is or not a command line app or not, but I have tried loading it using the .xinitrc as well as the bootloader and neither start it up.

I will tackle the perl script next, but I can run the flashapp w/o perl running, it will just return 0 for data.  But again, on dsl, I click run command, type /glfashplayer /main.swf (which I assume runs as dsl) and it starts fine.

I am not a 'bash scripter' yet, so not sure if there is something else on the lines I must put, but as I said, 'run command' type it works, so I typed just that in both the above files and neither starts on boot.

Tnx for all the help already.

Posted by xlancealotx on Dec. 12 2007,18:24
SOLVED:
It was permissions, when I removed the /var/log/messages, it fired up, so I simply moved the app and log files to a folder under the dsl acount.

Thanks.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.