Difference between revisions of "Rc-update"

From GhostBSD Wiki
Jump to: navigation, search
(Created page with "{{welcome}} {{Navbar OpenRC}} ==Introduction== Managing runlevels is usually done through the '''rc-update''' helper, but could of course be done by hand if desired. e.g. ''r...")
 
Line 8: Line 8:
 
All services must reside in the '''/etc/[[Init.d|init.d]]''' or '''/usr/[[Local/etc/init.d|local/etc/init.d]]''' directories. They must also conform to the '''OpenRC''' runscript standard.
 
All services must reside in the '''/etc/[[Init.d|init.d]]''' or '''/usr/[[Local/etc/init.d|local/etc/init.d]]''' directories. They must also conform to the '''OpenRC''' runscript standard.
  
===Rc-update===
+
==Manual==
  
<code>rc-update</code> shows all runlevels and services:
+
NAME
 +
   
 +
rc-update – add and remove services to and from a runlevel
 +
 
 +
SYNOPSIS
 +
    rc-update [-s, --stack] add service [runlevel ...]
 +
    rc-update [-s, --stack] [-a, --all] delete service [runlevel ...]
 +
    rc-update [-u, --update] [-v, --verbose] show [runlevel ...]
 +
 
 +
DESCRIPTION
 +
   
 +
[[OpenRC]] uses named runlevels.  Rather than editing some obscure file or    managing a directory of symlinks, rc-update exists to quickly add or    delete services to and from from different runlevels.  All services must    reside in the /etc/[[init.d]] or /usr/[[local/etc/init.d]] directories. 
 +
 
 +
They    must also be standard [[OpenRC]] scripts, meaning they must use openrc-run.
 +
 
 +
    add service            Add the service to the runlevel or the current
 +
                            one if none given.  Services added to the boot
 +
                            runlevel must exist in /etc/init.d.
 +
 
 +
    delete service          Delete the service from the runlevel or the
 +
                            current one if none given.
 +
 
 +
    show                    Show all enabled services and the runlevels they
 +
                            belong to.  If you specify runlevels to show,
 +
                            then only those will be included in the output.
 +
 
 +
    -v, --verbose          Show all services.
 +
 
 +
    -u, --update            Forces an update of the dependency tree cache.
 +
                            This may be needed in the event of clock skew (a
 +
                            file in /etc is newer than the system clock).
 +
 
 +
If the -s, --stack option is given then we either add or remove the    runlevel from the runlevel.  This allows inheritance of runlevels.
 +
 
 +
If the -a, --all option is given, we remove the service from all    runlevels. This is useful, for example, to clean up the dangling symlinks    after a service is removed.
 +
 
 +
 
 +
 
 +
===Rc-update Example===
 +
 
 +
<code>rc-update</code> without option shows all runlevels and services:
  
 
                   abi | boot                                   
 
                   abi | boot                                   

Revision as of 05:16, 13 April 2020

Welcome to Icon Disti GhostBSD.png Rc-update.
OpenRC
Scripts
/etc/rc
rc - shell
/etc/rc.devd
The generic hook into OpenRC.
/sbin/rcorder
Ordering rc-scripts
/etc/init.d
Scripts to run OpenRC
/usr/local/etc/init.d
Scripts to run OpenRC
/etc/rc.d
Scripts automatically executed at boot and shutdown
/usr/local/etc/rc.d
Special scripts
Configuration
/etc/devd.conf
Configuration file for devd(8)
/etc/conf.d
Initscript Configuration Files
/etc/rc.conf.d
Smaller configuration files
/etc/defaults/rc.conf
Specifies the default settings for all the available options.
/etc/rc.conf
The global OpenRC configuration file
/etc/rc.conf.ghostbsd
GhostBSD specific configurations
Tools/Helper
/usr/sbin/sysrc
Safely edit system rc files
/bin/rc-status
Shows which services are running
/sbin/rc-update
Add or delete services
/sbin/rc-service
Locate and run an OpenRC service
Back to the Icon Disti GhostBSD.pngSystem

Introduction

Managing runlevels is usually done through the rc-update helper, but could of course be done by hand if desired. e.g. rc-update add nginx default - add nginx to the default runlevel

All runlevels are represented as folders in /etc/runlevels/ with symlinks to the actual service scripts.
All services must reside in the /etc/init.d or /usr/local/etc/init.d directories. They must also conform to the OpenRC runscript standard.

Manual

NAME

rc-update – add and remove services to and from a runlevel

SYNOPSIS

    rc-update [-s, --stack] add service [runlevel ...]
    rc-update [-s, --stack] [-a, --all] delete service [runlevel ...]
    rc-update [-u, --update] [-v, --verbose] show [runlevel ...]

DESCRIPTION

OpenRC uses named runlevels. Rather than editing some obscure file or managing a directory of symlinks, rc-update exists to quickly add or delete services to and from from different runlevels. All services must reside in the /etc/init.d or /usr/local/etc/init.d directories.

They must also be standard OpenRC scripts, meaning they must use openrc-run.

    add service             Add the service to the runlevel or the current
                            one if none given.  Services added to the boot
                            runlevel must exist in /etc/init.d.
    delete service          Delete the service from the runlevel or the
                            current one if none given.
    show                    Show all enabled services and the runlevels they
                            belong to.  If you specify runlevels to show,
                            then only those will be included in the output.
    -v, --verbose           Show all services.
    -u, --update            Forces an update of the dependency tree cache.
                            This may be needed in the event of clock skew (a
                            file in /etc is newer than the system clock).

If the -s, --stack option is given then we either add or remove the runlevel from the runlevel. This allows inheritance of runlevels.

If the -a, --all option is given, we remove the service from all runlevels. This is useful, for example, to clean up the dangling symlinks after a service is removed.


Rc-update Example

rc-update without option shows all runlevels and services:

                 abi | boot                                   
           adjkerntz | boot                                   
        avahi-daemon |      default                           
      avahi-dnsconfd |      default                           
            bootmisc | boot                                   
              bridge | boot                                   
                cron | boot                                   
               cupsd |      default                           
                dbus |      default                           
                devd | boot                                   
               devfs |      default                           
               dmesg | boot                                   
              dumpon | boot                                   
                fsck | boot                                   
                hald |      default                           
              hostid | boot                                   
            hostname | boot                                   
             kldxref | boot                                   
             lightdm |      default                           
               local |      default nonetwork                 
          localmount | boot                                   
             modules | boot                                   
                motd | boot                                   
              moused |      default                           
            netmount |      default                           
             network | boot                                   
           newsyslog | boot                                   
                ntpd |      default                           
                root | boot                                   
             routing | boot                                   
           savecache |                        shutdown        
            savecore | boot                                   
         staticroute | boot                                   
                swap | boot                                   
             syscons | boot                                   
              sysctl | boot                                   
             syslogd | boot                                   
             urandom | boot                                   
             vboxnet |      default                           
             webcamd |      default                           
                 zfs | boot                                   
                zvol | boot

boot shows if a service starts at boot.

If you want a service starting at boot write as root:

rc-update add foo .

If a service don't have to start at boot write:

rc-update delete foo.