LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 01-06-2010, 05:24 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Rep: Reputation: 33
How to set a programm auto started when the machine is restarting


I've installed a JBoss-JON-Agent on a Linux-machine. Normally to start the JON-Agent I have to go to /opt/jboss/VGER1/Agent/bin/ and run ./ rhq-agent-wrapper.sh start

But sometimes the Linux-machine will be restarted and I have to start the JON-Agent manually.

Now what I want is: when the Linux-machine is restarting, the JON-Agent will be restarted.

How to do that?

I think I have to use 'chkconfig' etc. right?
 
Old 01-06-2010, 05:28 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can put the command in
Quote:
/etc/rc.local
 
Old 01-06-2010, 05:36 AM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
That is startup script right?
put it to following directory /etc/init.d/
#chkconfig --level 2345 scriptname on

here 2345 means runlevel(whatever the runlevel you need just mention on there)
 
Old 01-06-2010, 06:41 AM   #4
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
Quote:
Originally Posted by repo View Post
You can put the command in
What I tend to do it create an rc.[whatever] file, and then call that from rc.local only if the file is executable. that way you can set the file to accept commands like start, stop and restart and so can run the file alone (ie, without having to run everything else in rc.local). ALso, it allows you very easily stop something running without having to edit any files - just remove the executable flag from the file.
 
Old 01-06-2010, 09:44 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 539

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by kirukan View Post
That is startup script right?
put it to following directory /etc/init.d/
#chkconfig --level 2345 scriptname on

here 2345 means runlevel(whatever the runlevel you need just mention on there)
I did as follow:

1.
Create a script file and put it under /etc/rc.d/init.d/

2.
Set level
#chkconfig --level 0126 scriptname off
#chkconfig --level 345 scriptname on


Is it ok? Anyway it works.
 
  


Reply



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
Why can't this machine shutdown without automaticaly restarting? >SOL Linux - Newbie 10 08-04-2009 07:06 AM
How window in programm can be resized by another programm. rexStart Programming 1 09-23-2008 02:47 AM
order of auto-started programs yosato_uk Linux - Desktop 1 07-06-2008 09:59 PM
Restarting Windows machine stops Linux machine mounting/connecting jamespetts Linux - Networking 3 05-29-2008 03:12 AM
fetchmail working only after restarting machine sambyte Linux - General 1 01-03-2007 06:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:04 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
Open Source Consulting | Domain Registration