Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-24-2008, 01:23 AM   #1
Anshul Pathak
LQ Newbie
Registered: Nov 2008
Posts: 3

Rep: Reputation: 0
Question How to run shell script from rc.local


Can anybody tell me, How to run shell script at boot time ?

Anshul Pathak
Old 11-24-2008, 01:27 AM   #2
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You've sort of answered your question in the title, so what's not working?
Old 11-24-2008, 02:37 AM   #3
Anshul Pathak
LQ Newbie
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0

Originally Posted by billymayday View Post
You've sort of answered your question in the title, so what's not working?

Actually i have created a java layer and i want to run it on linux at boot time.I have also created the shell script to run that layer and now i want to know what to write in "rc.local" to run my script file at boot time.

Anshul Pathak
Old 11-24-2008, 08:22 AM   #4
LQ Newbie
Registered: Oct 2007
Location: Pune
Distribution: RHEL, SOLARIS, SUSE
Posts: 18

Rep: Reputation: 1
Just add your lines in rc.local (in end ).
/complete/path/to/binary/my_program &

Old 11-24-2008, 11:18 AM   #5
Registered: Oct 2008
Posts: 100

Rep: Reputation: 15
You can also install a script in /etc/init.d
The script should handle at least the start, stop and status input commands
Then use chkconfig -add <your-script> to set your script to be launched during booting, or just run
/etc/init.d/<your-script> start
This is how a lot of other services are being started

Last edited by Tinkster; 10-30-2010 at 05:13 PM.
Old 11-24-2008, 12:11 PM   #6
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Which user do you want this script to run as?
If you just put the /path/to/script into rc.local, it'll be run as root, with no GUI, and you are unlikely to see any error-reporting.
This may not be what you want.


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
MySQL Updates With Null When Perl Script Run From Shell Script ThisGuyIKnow Programming 6 08-12-2008 09:56 AM
Restrict a Shell Script to run from a shell bharaniks Linux - Security 7 08-26-2007 10:57 PM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 10:00 AM
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 07:20 AM
local rsync shell script eradrix Programming 13 07-09-2005 12:57 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:37 PM.

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