kanit

Toy init system
Log | Files | Refs | README | LICENSE

kanit-unit.5 (2909B)


      1 .\" kanit.unit.5 - man page for Kanit unit file format
      2 .\" SPDX-License-Identifier: CC0-1.0
      3 .TH KANIT.UNIT 5 "August 2025" "kanit 0.1.0" "File Formats and Conventions"
      4 .SH NAME
      5 kanit.unit \- unit file format for the Kanit init system
      6 .SH SYNOPSIS
      7 /etc/kanit/system/\fIunit\fR
      8 .SH DESCRIPTION
      9 The
     10 .B kanit.unit
     11 file format describes service units for the \fBkanit\fR(8) init system. Unit files define how services are launched, supervised, and related to each other.
     12 
     13 Each unit file is a plain-text configuration file, located under \fB/etc/kanit/system/\fIunit\fR\fR where \fIunit\fR is the name of the unit.
     14 
     15 .SH SYNTAX
     16 Unit files use an INI-style format, with simple
     17 .I key = value
     18 assignments. Keys and values are parsed literally; quoting may be used for arguments that contain spaces or special characters.
     19 
     20 Comments begin with a
     21 .B #
     22 character and continue to the end of the line.
     23 
     24 .SH FIELDS
     25 .SS Top-level fields
     26 .TP
     27 .B description
     28 A human-readable summary of the unit's purpose.
     29 
     30 .TP
     31 .B kind
     32 Specifies the unit type.
     33 Valid values are:
     34 .BR oneshot ,
     35 .BR daemon ,
     36 or
     37 .BR builtin .
     38 
     39 .TP
     40 .B pwd
     41 Working directory for the process.
     42 
     43 .TP
     44 .B root
     45 Root directory to chroot into before execution.
     46 
     47 .TP
     48 .B group
     49 Group identity to run as. Can be a numeric GID or group name.
     50 
     51 .TP
     52 .B user
     53 User identity to run as. Can be a numeric UID or username.
     54 
     55 .TP
     56 .B stdout
     57 Redirect standard output to a specified file.
     58 
     59 .TP
     60 .B stderr
     61 Redirect standard error to a specified file.
     62 
     63 .TP
     64 .B cmd
     65 Command to execute, with optional quoted or escaped arguments. Example:
     66 .RS
     67 .nf
     68 cmd = /bin/echo "Hello world" 'escaped\\nnewline'
     69 .fi
     70 .RE
     71 
     72 .SS [depends]
     73 Dependency relationships between units.
     74 
     75 .TP
     76 .B before
     77 List of units that this unit should start before.
     78 
     79 .TP
     80 .B after
     81 List of units that this unit should start after.
     82 
     83 .TP
     84 .B needs
     85 Hard dependencies. These units must be started successfully.
     86 
     87 .TP
     88 .B uses
     89 Soft dependencies. These units will be started if available, but do not fail the current unit on error.
     90 
     91 .TP
     92 .B wants
     93 Weak dependencies. These units may be started alongside, but are not required.
     94 
     95 .SS [environment]
     96 Environment variables to set for the process.
     97 .TP
     98 Each line sets a
     99 .B VAR = VALUE
    100 pair.
    101 
    102 .SS [restart]
    103 Restart behavior configuration.
    104 
    105 .TP
    106 .B delay
    107 Seconds to wait between restart attempts.
    108 
    109 .TP
    110 .B attempts
    111 Maximum number of restart attempts before giving up.
    112 
    113 .TP
    114 .B policy
    115 Restart policy: one of
    116 .BR never ,
    117 .BR always ,
    118 .BR on-success ,
    119 or
    120 .BR on-failure .
    121 
    122 .SH FILES
    123 .TP
    124 .B /etc/kanit/system/*.unit
    125 Unit definition files.
    126 
    127 .SH EXAMPLE
    128 .EX
    129 # simple daemon
    130 description = Example service
    131 kind = daemon
    132 
    133 cmd = /usr/bin/exampled
    134 
    135 [depends]
    136 after = :net
    137 needs = logger
    138 
    139 [environment]
    140 ENV_MODE = production
    141 
    142 [restart]
    143 policy = on-failure
    144 delay = 2
    145 attempts = 5
    146 .EE
    147 
    148 .SH AUTHOR
    149 Sylvia Ivory <git@sivory.net>
    150 
    151 .SH ISSUES
    152 Please report bugs or issues at:
    153 .UR mailto:git@sivory.net
    154 .UE
    155 
    156 .SH SEE ALSO
    157 .BR kanit (8)