{
    "mode": "man",
    "parameter": "INIT-D-SCRIPT",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/INIT-D-SCRIPT/json",
    "generated": "2026-10-22T13:21:59Z",
    "sections": {
        "NAME": {
            "content": "init-d-script — interpreter for short and simple init.d scripts\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Generic init.d script framework to reduce the redundant code in /etc/init.d/.  The goal is to\ncreate  an  init.d script that is Debian and LSB compliant.  When the Debian policy conflicts\nwith the LSB, the Debian policy takes precedence.\n\nThis is a simple example on how init-d-script can be used to start and stop a daemon with PID\nfile support:\n\n#!/bin/sh /lib/init/init-d-script\n### BEGIN INIT INFO\n# Provides:          atd\n# Required-Start:    $syslog $time $remotefs\n# Required-Stop:     $syslog $time $remotefs\n# Default-Start:     2 3 4 5\n# Default-Stop:      0 1 6\n# Short-Description: run at jobs\n# Description:       Debian init script to start the daemon\n#                    running at jobs.\n### END INIT INFO\nDAEMON=/usr/sbin/atd\n\nThe following variables affect behaviour of an init script:\n\nDAEMON         Path to daemon being started.  If the init script is not supposed to start any\nkind  of  daemon,  it  should   be   set   to   “none”   and   the   functions\ndostartoverride(), dostopoverride() and dostatusoverride() should be de‐\nfined instead.\n\nDAEMONARGS    Additional arguments, passed to daemon during start.\n\nDESC           Full  name  or  short description of the daemon, printed on screen.  If unset,\nthis variable defaults to the “NAME” value.\n\nNAME           Additional environment variables are sourced  from  /etc/default/${NAME}.   If\nunset, this variable defaults to the basename of the “DAEMON” value.\n\nCOMMANDNAME   If  this  variable  is  set,  it  is  used as argument to the --name option of\nstart-stop-daemon(8).  It may be useful if the value of the “NAME” variable is\nlonger than the command name length supported by the running kernel.   If  the\nvalue  is  verbatim  “none”,  the  command  name will not be used to match the\nprocesses.  If unset, this variable defaults to the “NAME” value.\n\nPIDFILE        Path to file where the process identifier of the started daemon will be stored\nduring start.  If the value is verbatim “none”, the  process  identifier  will\nnot  be  stored  in any file.  If this variable is not set, it gets a sensible\ndefault value, so it is rarely necessary to set this variable explicitly.\n\nRELOADSIGNAL  Signal number or name (without the SIG  prefix)  that  will  be  sent  to  the\nprocess  on  reload.   If  the  daemon performs reload action upon receiving a\nSIGHUP signal, this variable should be set to “1” or “HUP”.\n\nThe variables RELOADARGS, STARTARGS and  STOPARGS  are  additional  arguments,  passed  to\nstart-stop-daemon(8) during reload, start and stop actions, to override the default options.\n\nAdditionally,  it  is possible to change the behaviour of the resulting shell script by over‐\nriding some of the internal functions.  To do so, define function with an  override  suffix.\nSo,   for   example,   to   override   the   dostatus()   function,   one  should  define  a\ndostatusoverride() function.  The exception to this rule is the doreload() function, whose\noverride should be defined as-is, without the above-mentioned suffix.\n\nHere is a control flow chart that explains what functions are called and when:\n\n/etc/init.d/script start\ndostart\ndostartprepare # no-op\ndostartcmd     # start-stop-daemon is called here\ndostartcleanup # no-op\n\n/etc/init.d/script stop\ndostop\ndostopprepare # no-op\ndostopcmd     # start-stop-daemon is called here\ndostopcleanup # no-op\n\n/etc/init.d/script status\ndostatus\n\n/etc/init.d/script reload\ndoreload\ndousage\nexit 3\n\n/etc/init.d/script force-reload\ndoforcereload\ndoreload   # if overridden\ndorestart\ndorestartprepare\ndostopcmd\ndostartcmd\ndorestartcleanup\n\n/etc/init.d/script restart\ndoforcerestart\n/etc/init.d/script try-restart\nif dostatus; then\ndorestart\ndorestartprepare\ndostopcmd  # start-stop-daemon is called here\ndostartcmd # start-stop-daemon is called here\ndorestartcleanup\n\n/etc/init.d/script <arg>\ndounknown <arg>\nexit 3\n\n/etc/init.d/script\ndousage\n\nAs can be seen, by default, the script does not support the reload action; it should  be  im‐\nplemented by the script writer by defining a doreload() function.\n\nIf  doreload()  is  not defined but doreloadcmd() is, the latter will be called on reload,\nafter doreloadprepare() and before doreloadcleanup().\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "inittab(8), service(8), update-rc.d(8).\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Petter Reinholdtsen <pere@debian.org>\n\nDebian                                     August 5, 2019                           INIT-D-SCRIPT(5)",
            "subsections": []
        }
    },
    "summary": "init-d-script — interpreter for short and simple init.d scripts",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "inittab",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/inittab/8/json"
        },
        {
            "name": "service",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/service/8/json"
        },
        {
            "name": "update-rc.d",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/update-rc.d/8/json"
        }
    ]
}