LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to run a some binary file as soon as system boots up (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-a-some-binary-file-as-soon-as-system-boots-up-902779/)

balaqemu 09-13-2011 09:01 AM

How to run a some binary file as soon as system boots up
 
Hi,
I need to automate of running a some binary file (some application) as soon as system boots up .
How to do this ..?

regards
Bala

kilgoretrout 09-13-2011 09:07 AM

Which distro? Different distros have different init methods. What type of application? GUI apps will require X to be up and running and will have a different method for autostarting than a command line app. For a gui app, also list which DE; different DEs like kde or gnome have there own methods for autostarting graphical apps on startup. For a command line app, state whether it needs to be executed as root or an ordinary user.

mesuutt 09-13-2011 11:06 AM

If you want to run command line application such as bash script,you can write `su <username> -c <app_path>` in /etc/rc.local file above `exit 0`.
After you must make to executable the script.

kilgoretrout 09-13-2011 11:34 AM

Quote:

If you want to run command line application such as bash script,you can write `su <username> -c <app_path>` in /etc/rc.local file above `exit 0`.
After you must make to executable the script.
Not all distros have an rc.local(see Debian) and of those that do, not all distros place rc.local in /etc. Also, you can't start a gui app from rc.local. That's the reason for my questions.

Karl Godt 09-13-2011 04:09 PM

The folders in /etc should be /etc/init.d and /etc/rc.d .

Files of importance are also /sbin/init which calls the kernel first after mounting the rootfs/partition .

This can be a link to '/bin/busybox init' or a binary . It is possible to rename /sbin/init to /sbin/init.bin and make a #!/bin/sh -script in which you could run what you want and at the end run 'exec /sbin/init.bin' , which runs (sources) /etc/inittab which further runs mostly files in /etc/rc.d/* , 'busybox init' especially rc.sysinit , in which everything of importance gets mounted (proc,sysfs) , other files of rc.d or init.d run , drivers loaded , and so on .
You should have a look there .

Files named rc.0 or rc.5 indicate the runlevel , something , that Puppy Linux does not know much about , but larger distros have such files . rc.S would be a 'single user mode' ^configuration file^ .

man init : http://unixhelp.ed.ac.uk/CGI/man-cgi?init+8

and a good explanation found here :
http://www.comptechdoc.org/os/linux/...man/index.html

schneidz 09-13-2011 07:51 PM

you can add @reboot /path/to/program in your crontab.

balaqemu 09-14-2011 01:03 AM

Hi,
My distro is ubuntu 11.04 .

yes I want to run the script that is start.sh .

Here is the line which I have writtel to put in rc.local .

su user1 -c /home/user1/start.sh .

but this is still not working for me ..?

dudeman41465 09-14-2011 01:12 AM

If you want it when you log in, just go to "System -> Preferences -> Starup Applications" in Gnome.

kilgoretrout 09-14-2011 05:12 AM

Post your start.sh script. I assume you already tested the script and it executes without error when you manually run it after login. If the user is logging into gnome, dudeman's suggestion should work. You can also put:

/home/user1/start.sh

at the end of user1's bashrc file and it should execute on login from a command line login.

schneidz 09-14-2011 01:06 PM

Quote:

Originally Posted by balaqemu (Post 4471175)
Hi,
My distro is ubuntu 11.04 .

yes I want to run the script that is start.sh .

Here is the line which I have writtel to put in rc.local .

su user1 -c /home/user1/start.sh .

but this is still not working for me ..?

is your username really user1 ?; is the file executable ?


All times are GMT -5. The time now is 02:19 AM.