LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-14-2011, 12:06 PM   #1
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Rep: Reputation: 0
startup script


How do I add a script to rc.local to run at bootup??I've few .sh files, service files and .cgf files

the service files are fine but the .sh file didn't startup at the bootup

I've included the .sh and cfg file as below

/path/to/directory/file.sh start
/path/to/directory file.cfg

Thanks
 
Old 03-14-2011, 12:10 PM   #2
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
1) Copy your script to /etc/init.d
2) See man page for chkconfig.
 
Old 03-14-2011, 12:16 PM   #3
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
did you mean to copy file.sh and file.cfg to the init.d directory?
 
Old 03-14-2011, 12:25 PM   #4
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Just the shell script. The config file doesn't belong in init.d.

Though to be honest, it'd probably be helpful if you pointed out what it is you're trying to start, because if you have one product that came with both a "service file" and a shell script, then the one you want to use is the service.
 
Old 03-14-2011, 12:32 PM   #5
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
I'm trying to start some service that are needed to run some applications on the server.

mysql,tomcat startup,application startup scripts and second application cfg file
 
Old 03-14-2011, 12:52 PM   #6
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
so,how do I add a cfg file to run at bootup? Also,I've two versions of tomcat that I need to run with the same name?If I were to copy them to init.d how do I copy them??both scripts have same name which worries me
 
Old 03-14-2011, 01:52 PM   #7
wpeckham
Senior Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 1,648

Rep: Reputation: 567Reputation: 567Reputation: 567Reputation: 567Reputation: 567Reputation: 567
init.d script

You may also check rc.local and place a call to the script late in that file, if it exists.

I may have missed something, but I did not read what version of Linux you are using. Since the specific startup systems and events differ slightly (Greatly, if you run Ubuntu), it is not possible to give a detailed answer.

Would you like to offer a little more detail, or have we provided enough to get you started?
 
Old 03-14-2011, 02:27 PM   #8
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by ansrewdps View Post
so,how do I add a cfg file to run at bootup? Also,I've two versions of tomcat that I need to run with the same name?If I were to copy them to init.d how do I copy them??both scripts have same name which worries me
Why are you trying to "run" a config file? Config files aren't executables. They're full of configuration information that should be read by an executable.

If you want to run two versions of Tomcat, rename one (or both) service scripts so they have unique names.

Or, if init.d is causing you too much anguish, there's always an alternative: /etc/inittab.
 
Old 03-21-2011, 02:31 PM   #9
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
Sorry for late reply.

I need to run the .cfg file to access a administrator page on the browser. I tried to add the symbolic links to the rc3.d directory for the .sh scripts and should test that.

however,I'm still stuck up on how to run the cfg file on boot.Can somebody guide me
 
Old 03-21-2011, 02:48 PM   #10
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Honestly, I still don't understand what you're trying to do here. I think you're asking the wrong questions.

But to answer the question that has been presented, to run something at boot-up, you've already been given the answers.

1) Copy file to /etc/init.d
2) Run chkconfig

OR

1) Add an entry to /etc/inittab

OR

1) Add a reference to your file to rc.local (if it exists)

You should NOT be creating your own links in rc3.d. That's what chkconfig does for you.
 
Old 03-21-2011, 03:00 PM   #11
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
Ok, I'm sorry about that.

Here's the thing.We're working on media delivery application that delivers videos/audios on demand.To start the server I need to run .cfg file.I works well when I run the command from command-line.However,I need to the machine to run that command on boot,just like startup scripts.

Here is the thing I found in the documentation.

To start the Server
1. Start any command shell.
2. Navigate to the main Server or Proxy installation directory.
3. Choose one of the following options:
a. Start the server or proxy as a background process. Use the following command for Server: Bin/rmserver rmserver.cfg &
......
 
Old 03-21-2011, 03:52 PM   #12
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
So in other words, you're not running the config file, the config file is just an argument you're passing to the rmserver command.

Since the process you're trying to start is extremely crude, I'd just add an entry to /etc/inittab.
 
Old 03-22-2011, 10:57 AM   #13
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
So,adding an entry like this will make it??

rmsr:3:respawn:Bin/rmserver rmserver.cfg

Sorry,I'm new to this kind
 
Old 03-22-2011, 11:22 AM   #14
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
1) Use the full path to that bin/rmserver executable. The path bin/rmserver is only valid because you've cd'd to the rest of the path first, which won't happen in inittab.
2) Only use "respawn" if you really mean it. If you might need to shut it down for a maintenance process, you won't want it restarting on you, and you'd be better off with "once."

Otherwise... yeah.
 
Old 03-23-2011, 11:30 AM   #15
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
I tried that.But, for whatever the reason it doesn't start this service on boot.

Also, when I try to start an tomcat instance by creating a file in init.d and chkconfig that service it worked well.However,when I try to start that service it says /etc/init.d/catalina.sh is missing.Need that file to start.

So,I placed the contents of catalina.sh(not sure though whether I'm going right) in the init.d directory file.It then asks for "setclasspath.sh" file saying /etc/bin/setclasspath.sh missing need that file to start.

These files are in the respective directories of tomcat installation directory and echo $catalina_home gives me the path to the apache installation directory,but still it shows as if the catalina directory is not set

even I'd that paths added in rc.local as

/path/to/direcotory/startup.sh
/path/to directory/Bin/rmserver rmserver.cfg

Any suggestions?
 
  


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
Help: Startup script aloneattack Red Hat 2 03-06-2008 04:01 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 03:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 10:40 PM
startup script rockwell_001 Linux - General 4 04-21-2005 05:22 PM
Startup Script LtcJohnson Linux - Newbie 2 10-26-2004 12:22 AM


All times are GMT -5. The time now is 04:21 PM.

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