Ubuntu下服务管理

添加一个服务 

sudo update-rc.d 服务名 defaults 

删除一个服务 

sudo update-rc.d -f 服务名 remove

服务启动和停止 

/etc/init.d/服务名 start|restart|stop|status

Serivice命令:

Ubuntu:$~#man service



service(8)                                                          service(8)

NAME
       service - run a System V init script

SYNOPSIS
       service SCRIPT COMMAND [OPTIONS]

       service --status-all

       service --help | -h | --version

DESCRIPTION
       service  runs  a  System V init script in as predictable environment as
       possible, removing most environment variables and with current  working
       directory set to /.

       The  SCRIPT  parameter  specifies  a  System  V init script, located in
       /etc/init.d/SCRIPT.  The supported values  of  COMMAND  depend  on  the
       invoked  script,  service  passes  COMMAND  and  OPTIONS it to the init
       script unmodified.  All scripts should support at least the  start  and
       stop  commands.   As  a special case, if COMMAND is --full-restart, the
       script is run twice, first with the stop command, then with  the  start
       command.

       service --status-all runs all init scripts, in alphabetical order, with
       the status command.

EXIT CODES
       service calls the init script and returns the status returned by it.

FILES
       /etc/init.d
              The directory containing System V init scripts.

ENVIRONMENT
       LANG, TERM
              The only environment variables passed to the init scripts.

SEE ALSO
       /etc/init.d/skeleton,
       update-rc.d(8),
       init(8),
       invoke-rc.d(8).

                                   Jan 2006                         service(8)


----------------------------------
root@ubuntu:/etc/init.d# service -h
Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]
到底要怎样使用这些参数呢?没有模板很郁闷阿,亲手试一下
root@ubuntu:/etc/init.d# service --status-all
 [ ? ]  acpi-support
 [ ? ]  acpid
 [ ? ]  alsa-mixer-save
 [ ? ]  anacron
 [ + ]  apparmor
 [ ? ]  apport
 [ ? ]  atd
 [ ? ]  avahi-daemon
 [ ? ]  binfmt-support
 [ - ]  bluetooth
 [ - ]  bootlogd
 [ - ]  brltty
 [ ? ]  console-setup
 [ ? ]  cron
 [ + ]  cups
 [ ? ]  dbus
 [ ? ]  dmesg
 [ ? ]  dns-clean
 [ ? ]  failsafe-x
 [ - ]  fancontrol
 [ ? ]  gdm
 [ - ]  grub-common
 [ ? ]  hostname
 [ ? ]  hwclock
 [ ? ]  hwclock-save
 [ ? ]  irqbalance
 [ - ]  kerneloops
 [ ? ]  killprocs
 [ - ]  lm-sensors
 [ ? ]  module-init-tools
 [ ? ]  network-interface
 [ ? ]  network-interface-security
 [ ? ]  network-manager
 [ ? ]  networking
 [ ? ]  ondemand
 [ ? ]  pcmciautils
 [ ? ]  plymouth
 [ ? ]  plymouth-log
 [ ? ]  plymouth-splash
 [ ? ]  plymouth-stop
 [ ? ]  pppd-dns
 [ ? ]  procps
 [ + ]  pulseaudio
 [ ? ]  rc.local
 [ - ]  rsync
 [ ? ]  rsyslog
 [ - ]  saned
 [ ? ]  screen-cleanup
 [ ? ]  sendsigs
 [ ? ]  speech-dispatcher
 [ ? ]  stop-bootlogd
 [ ? ]  stop-bootlogd-single
 [ ? ]  udev
 [ ? ]  udev-finish
 [ ? ]  udevmonitor
 [ ? ]  udevtrigger
 [ ? ]  ufw
 [ ? ]  umountfs
 [ ? ]  umountnfs.sh
 [ ? ]  umountroot
 [ ? ]  unattended-upgrades
 [ - ]  urandom
 [ + ]  vmware-tools
 [ ? ]  wpa-ifupdown

 [ - ]  x11-common

example2:

root@ubuntu:/etc/init.d# : service mysql start|stop|status

转自:http://blog.chinaunix.net/uid-21528208-id-2399656.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值