第 16 章 设备管理

简介:

16.1. Debian/Ubuntu

16.1.1. update-rc.d - install and remove System-V style init script links

for example:

Insert links using the defaults:
   update-rc.d foobar defaults
Equivalent command using explicit argument sets:
   update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 .
More typical command using explicit argument sets:
   update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 .
Insert links at default runlevels when B requires A
   update-rc.d script_for_A defaults 80 20
   update-rc.d script_for_B defaults 90 10
Insert a link to a service that (presumably) will not be needed by any other daemon
   update-rc.d top_level_app defaults 98 02
Insert links for a script that requires services that start/stop at sequence number 20
   update-rc.d script_depends_on_svc20 defaults 21 19
Remove all links for a script (assuming foobar has been deleted already):
   update-rc.d foobar remove
Example of disabling a service:
   update-rc.d -f foobar remove
   update-rc.d foobar stop 20 2 3 4 5 .
Example of a command for installing a system initialization-and-shutdown script:
   update-rc.d foobar start 45 S . stop 31 0 6 .
Example of a command for disabling a system initialization-and-shutdown script:
   update-rc.d -f foobar remove
   update-rc.d foobar stop 45 S .
		

set default

update-rc.d nginx defaults
		

remove

update-rc.d -f lighttpd remove
$ sudo update-rc.d -f avahi-daemon remove
		

16.1.2. invoke-rc.d - executes System-V style init script actions

$ sudo invoke-rc.d mysql restart
		

16.1.3. runlevel

$ runlevel
N 2

# runlevel
N 3
		
$ sudo vim /etc/init.d/rcS
#! /bin/sh
#
# rcS
#
# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order
#

exec /etc/init.d/rc S
		

the default is S (/etc/rcS.d/)

the redhat linux in the /etc/inittab

switch runlevel

/etc/init.d/rc 3
		

16.1.4. sysv-rc-conf

(ubuntu下sysv-rc-conf命令等同redhat下chkconfig命令)

$ sudo apt-get install sysv-rc-conf
		

进入sysv-rc-conf TUI用户界面,你可以使用键盘方向键切换,使用空格键选择“X”表示选中,这个软件也支持鼠标操作。

$ sudo sysv-rc-conf
		
sysv-rc-conf gmond on
sysv-rc-conf --list gmond
		

16.1.5. xinetd - replacement for inetd with many enhancements

$ sudo apt-get install xinetd
		

16.1.5.1. tftpd

apt-get install xinetd
apt-get install tftpd tftp
			

/etc/xinetd.d/tftp

service tftp
{
	disable=no
	socket_type=dgram
	protocol =udp
	wait=yes
	user=root
	server=/usr/sbin/in.tftpd
	server_args =-s /home/neo/tftpboot -c
	per_source=11
	cps=100 2
	flags=IPv4
}
			

16.1.6. Scheduled Tasks

16.1.6.1. crontab - maintain crontab files for individual users

To see what crontabs are currently running on your system, you can open a terminal and run:

$  crontab -l
# m h  dom mon dow   command
#* */30 * * * /home/neo/dyndns
			

if you want to see root user, please add 'sudo' in the prefix.

To edit the list of cron jobs you can run:

$ crontab -e
			

As you can see there are 5 stars. The stars represent different date parts in the following order:

  1. minute (from 0 to 59)

  2. hour (from 0 to 23)

  3. day of month (from 1 to 31)

  4. month (from 1 to 12)

  5. day of week (from 0 to 6) (0=Sunday)

By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

			
>/dev/null 2>&1
			
			

16.1.6.2. at, batch, atq, atrm - queue, examine or delete jobs for later execution

16.1.7. sv - control and manage services monitored by runsv

services directory /etc/service/

$ sudo sv start git-daemon
ok: run: git-daemon: (pid 10323) 1s

$ sudo sv restart git-daemon
ok: run: git-daemon: (pid 10327) 1s

$ sudo sv stop git-daemon
ok: down: git-daemon: 1s, normally up
		

16.1.7.1. runsv

$ sudo runsv git-daemon
			

16.1.7.2. runsvdir

运行/etc/service目录下的所有服务

			
$sudo runsvdir /etc/service &
			
			




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
1月前
|
前端开发 数据可视化 JavaScript
设备管理模块实现
设备管理模块实现
52 3
|
1月前
|
物联网 开发工具
【开源视频联动物联网平台】设备管理
【开源视频联动物联网平台】设备管理
30 2
|
7月前
|
存储 JSON 物联网
设备管理组件功能介绍
设备管理组件功能介绍
224 0
|
8月前
|
API 开发者
HarmonyOS学习路之开发篇—设备管理(控制类小器件)
控制类小器件指的是设备上的LED灯和振动器。其中,LED灯主要用作指示(如充电状态)、闪烁功能(如三色灯)等;振动器主要用于闹钟、开关机振动、来电振动等场景。
|
6月前
|
存储 算法 调度
设备管理
一、设备管理 设备管理是操作系统中的一个重要功能,它负责管理计算机系统中的各种硬件设备,包括输入设备、输出设备和存储设备等。设备管理的主要任务包括设备分配、设备驱动程序管理、设备中断处理和设备错误处理等。 设备分配是指将多个进程对设备的请求进行合理分配,以实现设备的共享和高效利用。设备管理需要维护设备队列,记录设备的使用情况和状态,根据进程的请求进行设备分配。设备分配可以采用多种方式,包括独占分配、共享分配和虚拟设备等。 设备驱动程序管理是指管理设备驱动程序的加载、运行和卸载等操作。设备驱动程序是操作系统中的一个关键组件,它负责与硬件设备进行通信和控制。设备管理需要加载适当的设备驱动程序,并确
60 0
|
6月前
|
存储 算法 调度
计算机设备管理
计算机设备管理是操作系统的一个重要功能,它负责管理和控制计算机系统中的各种硬件设备,包括输入设备、输出设备和存储设备等。
42 0
|
9月前
|
程序员 虚拟化
操作系统如何进行设备管理
操作系统如何进行设备管理
197 1
操作系统如何进行设备管理
|
11月前
第6章 设备管理
第6章 设备管理
96 0
|
物联网
阿里云物联网平台设备模拟器
在使用阿里云物联网平台过程中,如果开始调试没有实际的物理设备,可以考虑在阿里云物联网平台使用官方自带的模拟器进行调试。不过也可以通过叶帆科技开发的阿里云物联网平台设备模拟器AliIoTSimulator进行调试,AliIoTSimulator可以独立运行(需要单独加载物模型配置信息),也可以由阿里云物联网平台专用工具(AliIoTTools)直接启动。
953 0
阿里云物联网平台设备模拟器
|
调度
【操作系统知识】I/O 设备管理软件
【操作系统知识】I/O 设备管理软件
179 0