开机启动程序配置(OpenRC init系统)——玩转alpine linux

alpine linux 采用openrc来管理init系统。

  1. apk add openrc 安装openrc

  2. 添加删除开机启动服务rc-update

命令 说明
rc-update add nginx 增加一个服务
rc-update del nginx 删除一个服务

软件名可以从/etc/init.d/中查找。

  1. rc-status 查询服务状态
  • rc-status 显示默认运行级别的服务
edge:/etc/local.d# rc-status
Runlevel: default
 docker                                                [  started 00:28:58 (0) ]
 acpid                                                             [  started  ]
 crond                                                             [  started  ]
 sshd                                                              [  started  ]
 chronyd                                                           [  started  ]
 local                                                             [  stopped  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 sysfs                                                             [  started  ]
 fsck                                                              [  started  ]
 root                                                              [  started  ]
 localmount                                                        [  started  ]
 cgroups                                                           [  started  ]
Dynamic Runlevel: manual
  • rc-status -a 显示所有运行服务
edge:/etc/local.d# rc-status -a
Runlevel: default
 docker                                                [  started 00:27:44 (0) ]
 acpid                                                             [  started  ]
 crond                                                             [  started  ]
 sshd                                                              [  started  ]
 chronyd                                                           [  started  ]
 local                                                             [  stopped  ]
Runlevel: shutdown
 savecache                                                         [  stopped  ]
 killprocs                                                         [  stopped  ]
 mount-ro                                                          [  stopped  ]
Runlevel: sysinit
 devfs                                                             [  started  ]
 dmesg                                                             [  started  ]
 mdev                                                              [  started  ]
 hwdrivers                                                         [  started  ]
Runlevel: boot
 modules                                                           [  started  ]
 hwclock                                                           [  started  ]
 swap                                                              [  started  ]
 loadkmap                                                          [  started  ]
 hostname                                                          [  started  ]
 sysctl                                                            [  started  ]
 bootmisc                                                          [  started  ]
 networking                                                        [  started  ]
 urandom                                                           [  started  ]
 syslog                                                            [  started  ]
Runlevel: nonetwork
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 sysfs                                                             [  started  ]
 fsck                                                              [  started  ]
 root                                                              [  started  ]
 localmount                                                        [  started  ]
 cgroups                                                           [  started  ]
Dynamic Runlevel: manual
  1. rc-service 服务启停管理和service命令一致,这里不赘述。

你可能感兴趣的:(操作系统,linux,alpine)