LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-23-2003, 01:36 PM   #1
ashley75
Member
 
Registered: Aug 2003
Posts: 232

Rep: Reputation: 30
startup the service automatically


I have the backup agent running on this server and it's Redhat Linux Advance Server 2.1.

1. What do I need to do in order for this service startup automatically everytime I reboot the server.

2. Do I have the write scripts in Linux????

3. If I have to write scripts, how do I start, is there any good books or resource for me to learn???

thanks so much for all of the help in the past.
 
Old 09-23-2003, 01:59 PM   #2
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Rep: Reputation: 78
Go into your /etc/init.d, in there are scripts to stop/start/restart processes. Open one up and look at it. It looks some thing like this:

#! /bin/sh
# /sbin/init.d/runlevel.3

case "$1" in
start)
need runlevel.2
need portmap
mount -vat nfs
;;
stop)
umount -vat nfs
;;
esac
# End

You can add the command to start the service under start and the command to stop the service under stop and even add a restart command. Then you'll need to add this to a run level. I believe that 3 should do. Then if you wanted to restart the service, you could type /etc/init.d/backupagent restart.
 
Old 09-23-2003, 02:06 PM   #3
ashley75
Member
 
Registered: Aug 2003
Posts: 232

Original Poster
Rep: Reputation: 30
to start the backup agent, I can simply type:

uagent start


do you mean that I can simply add this commnand in anywhere on the mentioned file???


thanks
 
Old 09-23-2003, 02:25 PM   #4
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Rep: Reputation: 78
I believe that this will work.

#! /bin/sh
# /sbin/init.d/runlevel.3

case "$1" in
start)
uagent start
;;
stop)
uagent stop
;;
restart)
uagent restart
;;
esac
# End

Then you will have to add it to the runlevel that you want. I use slack and am not really sure exactly how RH runlevels work. I think that they are in the /etc/rc.d/rc.x, where x is 1 to 6. If you look around on the net you will find out exactly what you need to do.
 
Old 09-24-2003, 02:14 AM   #5
shawnchin
LQ Newbie
 
Registered: Sep 2003
Location: Malaysia
Distribution: Redhat, Gentoo
Posts: 18

Rep: Reputation: 0
If it's just one command that you want to run on boot (for example uagent), just append the line to your /etc/rc.local file.

This ought to do the trick.
# echo "uagent start" >> /etc/rc.local

... of, do it the traditional way and edit /etc/rc.local with an editor


Cheers
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to automatically connect on startup? PerfectReign Linux - Wireless Networking 6 09-16-2005 01:44 AM
Automatically Restart Service tulip4heaven Linux - General 1 04-23-2005 02:11 AM
Any way to startup daemon automatically? Niceman2005 Linux - Newbie 2 01-12-2005 09:27 PM
Is there a service or daemon that will automatically mount my removable media? enigma Z Linux - Software 2 09-24-2004 06:19 PM
How do you control if a service (cron for example) is started automatically? Rimmer Linux - General 2 05-16-2001 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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