LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   startup script (https://www.linuxquestions.org/questions/linux-newbie-8/startup-script-868496/)

ansrewdps 03-14-2011 11:06 AM

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

SL00b 03-14-2011 11:10 AM

1) Copy your script to /etc/init.d
2) See man page for chkconfig.

ansrewdps 03-14-2011 11:16 AM

did you mean to copy file.sh and file.cfg to the init.d directory?

SL00b 03-14-2011 11:25 AM

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.

ansrewdps 03-14-2011 11:32 AM

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

ansrewdps 03-14-2011 11:52 AM

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

wpeckham 03-14-2011 12:52 PM

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?

SL00b 03-14-2011 01:27 PM

Quote:

Originally Posted by ansrewdps (Post 4290396)
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.

ansrewdps 03-21-2011 01:31 PM

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

SL00b 03-21-2011 01:48 PM

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.

ansrewdps 03-21-2011 02:00 PM

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 &
......

SL00b 03-21-2011 02:52 PM

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.

ansrewdps 03-22-2011 09:57 AM

So,adding an entry like this will make it??

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

Sorry,I'm new to this kind

SL00b 03-22-2011 10:22 AM

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.

ansrewdps 03-23-2011 10:30 AM

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?


All times are GMT -5. The time now is 12:42 PM.