LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 05-26-2006, 12:06 AM   #1
mblames
Member
 
Registered: Apr 2006
Location: Place for all OpenSource
Distribution: OpenBSD 4.1, FC5
Posts: 50

Rep: Reputation: 15
Question MRTG Starts As A Service ??


Hi all,
i have a simple question,
and it goes like this,How to make my MRTG starts as a service?
Something like this when root@xxxxx#mrtg.start and it will start the mrtg,and the rest.
And it runs auto when i (re)boot.
Does anyone have any idea?

Thanks before
 
Old 05-26-2006, 12:10 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Usually you write a script for it, and stick the script in /etc/init.d

An example - fedora starts iptables as a service ... /etc/init.d/iptables start
 
Old 05-26-2006, 04:27 AM   #3
mblames
Member
 
Registered: Apr 2006
Location: Place for all OpenSource
Distribution: OpenBSD 4.1, FC5
Posts: 50

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Simon Bridge
Usually you write a script for it, and stick the script in /etc/init.d

An example - fedora starts iptables as a service ... /etc/init.d/iptables start

can u give me the script coz i have no idea at all ?
 
Old 05-28-2006, 02:01 AM   #4
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
It's been a while since I've seen the init.d scripts for fedora.
You should look at /etc/init.d/iptables for the general layout.

A bash script tutorial:
http://www.tldp.org/LDP/abs/html/
(because you're gonna need it sometime.)

The script needs to accept input commands "start" and "stop", with each running the appropriate command.

If I imagine I have a service I want to call "foobar" ... from cli I would normally start it with /sbin/fubar, and stop it with /sbin/fubar -k ... then I'd write a script (call it fubar) containing something like:
Code:
case $1 in
  "start" )
    /sbin/fubar
  "stop" )
    /sbin/fubar -k
esac
(I think - it's been a while)

Then it will start at the command: /etc/init.d fubar start ; and stop at the command /etc/init.d/fubar stop .

These scripts usually contain other lines to idiotproof it (which is why I called this example "fubar"). Normally there is more than one command that needs to be run for start and stop - you just stick in whatever the sequence of cli commands would be. You'll see that in the /etc/init.d/iptables script - there, the commands will be in a function (I'm guessing) which is called from the case/esac loop.

I have a suspicion this is not exactly what you want to do though.
This will start your script as a service - but what do you hope to acheive thus? Perhaps you just want MRTG started at boot?
 
Old 05-29-2006, 06:01 AM   #5
mblames
Member
 
Registered: Apr 2006
Location: Place for all OpenSource
Distribution: OpenBSD 4.1, FC5
Posts: 50

Original Poster
Rep: Reputation: 15
Problem solved,i'm using script from the http://www.yolinux.com/TUTORIALS/Lin...itProcess.html .
But thanks anyway Simon, i try to understand both scripts and i did it.Thanks for helping Simon.
 
  


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
Two Fluxbox Versions - Root starts newest,User starts oldest fortezza Linux - Software 1 05-21-2006 01:17 AM
Linux services which service starts when ReBeL24 Fedora 4 05-24-2005 08:37 AM
where are the service that starts on boot resides bhupee Linux - General 1 07-01-2004 06:02 AM
rrd mrtg & mrtg-rrd.cgi ducati620 Linux - Newbie 0 06-03-2004 07:29 PM
nfs service starts, however it takes 15 mins Kilka Linux - Networking 3 04-30-2004 04:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

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