LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-13-2011, 10:01 AM   #1
balaqemu
LQ Newbie
 
Registered: Aug 2011
Posts: 19

Rep: Reputation: Disabled
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
 
Old 09-13-2011, 10:07 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,474

Rep: Reputation: 189Reputation: 189
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.

Last edited by kilgoretrout; 09-13-2011 at 10:16 AM.
 
Old 09-13-2011, 12:06 PM   #3
mesuutt
Member
 
Registered: Jan 2011
Location: İstanbul
Distribution: Slackware,Debian
Posts: 62

Rep: Reputation: 1
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.
 
Old 09-13-2011, 12:34 PM   #4
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,474

Rep: Reputation: 189Reputation: 189
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.

Last edited by kilgoretrout; 09-13-2011 at 12:42 PM.
 
Old 09-13-2011, 05:09 PM   #5
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
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
 
Old 09-13-2011, 08:51 PM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
you can add @reboot /path/to/program in your crontab.
 
Old 09-14-2011, 02:03 AM   #7
balaqemu
LQ Newbie
 
Registered: Aug 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
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 ..?
 
Old 09-14-2011, 02:12 AM   #8
dudeman41465
Member
 
Registered: Jun 2005
Location: Kentucky
Distribution: Ubuntu
Posts: 794

Rep: Reputation: 56
If you want it when you log in, just go to "System -> Preferences -> Starup Applications" in Gnome.
 
Old 09-14-2011, 06:12 AM   #9
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,474

Rep: Reputation: 189Reputation: 189
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.

Last edited by kilgoretrout; 09-14-2011 at 07:51 AM.
 
Old 09-14-2011, 02:06 PM   #10
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
Quote:
Originally Posted by balaqemu View Post
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 ?

Last edited by schneidz; 09-14-2011 at 02:07 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
unable to run c program , error : cannot execute binary file soni_silver17 Linux - Software 4 03-30-2009 09:45 AM
where is the final file system(after slax boots) from?? neilengineer Slackware 1 03-01-2007 01:48 PM
How do I get a script file to run automatically when linux boots? kccrusher Linux - Software 4 11-13-2006 10:55 PM
How to run a binary file shipon_97 Linux - Newbie 4 05-22-2006 12:02 PM
can we run the binary file directly kamesh156 Linux - General 1 10-17-2005 08:57 AM


All times are GMT -5. The time now is 01:12 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration