LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 06:24 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Rep: Reputation: 32
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, 06:28 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

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

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, 07:41 AM   #4
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 548

Rep: Reputation: 116Reputation: 116
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, 10:44 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
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


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


All times are GMT -5. The time now is 06:04 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