如何在Fedora Linux OS版本14上配置服务 [英] How to config a service on fedora linux OS at version 14
问题描述
大家好:
我想在程序14上在fedora linux上配置一个程序(例如Helloworld)作为服务,当我按下Computor电源按钮,然后启动我的linux系统时,我希望该程序(Helloworld)自动启动也.我可以使用服务状态,服务重启,服务停止
命令来启动或停止我的这项服务.
我找到了一些信息并了解了如何配置它.他们说使用etc文件夹上的inetd.conf文件,但在/etc上找不到此文件.
您能告诉我如何配置它,越详细,就越好!
谢谢大家!
Hi,everyone:
I want to config a program(Helloworld for instance) as a service on fedora linux with that version 14,when I press the computor power button, and then start my linux system.When the system started I hope the program(Helloworld) started automatically too. I can use the service status、service restart、service stop
command to start or stop this service of mine.
I find some information and aritcle how to config it.They say use the inetd.conf file on etc folder,but i can not find this file on /etc.
Can you tell me how to config it,the more detailed, the more better!
Thank you everyone!
推荐答案
忽略任何有关inetd的文章,它们与Fedora无关.
要配置服务,您需要在/etc/init.d/
中添加一个Shell脚本,其中包含启动,停止和重新启动程序的功能.请参见
Ignore any articles talking about inetd, they aren''t relevant to Fedora.
To configure a service you need to add a shell script in/etc/init.d/
that contains functions to start, stop and restart your program. See the documentation in
/usr/share/docs/initscripts-9.20.2/sysvinitfiles<br />
和man chkconfig
中的文档
如有其他问题,请尝试 Fedora论坛 [
and man chkconfig
For additional questions, try the Fedora Forums[^]
您有一种简单的方法.
您需要编写一个自定义脚本来管理正在添加的服务的启动/停止/重新启动.
该脚本的框架看起来像这样.
You have a simple way of doing it.
You need to write a custom script that will manage the start/stop/restart of the service that is being added.
The skeleton of that script looks like this.
#!/bin/bash
ReturnVal=0
start()
{
# Star the service.
echo "Service is being started..."
}
stop()
{
# Stop the service here.
echo "Service is being stopped..."
}
restart()
{
echo "Service is being Restarted..."
stop
start
}
# Main Wrapper
case ''
1'' 开始) 开始 ;; 停止) 停止 ;; 重新开始) 重新开始 ;; *) 回显与服务相关的无效选项." 回声
1'' in start) start ;; stop) stop ;; restart) restart ;; *) echo "Invalid Option related to the Service." echo
这篇关于如何在Fedora Linux OS版本14上配置服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!