You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/readme.md
+34-16Lines changed: 34 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,11 @@
1
1
# Command line interface
2
+
2
3
`zinit` provides sub commands to run as init process, and ctrl commands to start, stop, and query running services.
3
4
Run `zinit --help` to show a list of the current implemented sub-commands.
4
5
5
6
## init
6
-
the init sub-command is the main mode for zinit.
7
+
8
+
the init sub-command is the main mode for zinit.
7
9
It reads the configured services files in available in the config directory`/etc/zinit` or anopther one provided by the`-c` flag. Then it auto monitors those services.
8
10
9
11
When a service is monitored, it means that it's auto started, and then watched in case the service exited for any reason. When a service exits, it's automatically restarted, unless it's marked as a `oneshot`
@@ -14,15 +16,15 @@ If you want to read more about `zinit` process manager please check [here](imple
14
16
15
17
When running zinit in a container, supply the `--container` argument to the init command.
16
18
17
-
18
19
### Service configuration
20
+
19
21
```yaml
20
22
exec: "command line to start service"
21
23
test: "command line to test service is running"# optional
22
24
oneshot: true or false (false by default)
23
25
after: # list of services that we depend on (optional)
24
-
- service1_name
25
-
- service2_name
26
+
- service1_name
27
+
- service2_name
26
28
signal: # optional section
27
29
stop: SIGKILL # the signal sent on `stop` action. default to SIGTERM
28
30
log: null | ring | stdout
@@ -44,18 +46,22 @@ env:
44
46
- env (dict) is an extra set of env variables (KEY, VALUE) paris that would be available on a service
45
47
46
48
> Note: to use `ring` inside docker make sure you add the `kmsg` device to the list of allowed devices
49
+
47
50
```
48
51
docker run -dt --device=/dev/kmsg:/dev/kmsg:wm zinit
-s, --socket <SOCKET> path to unix socket [default: /var/run/zinit.sock]
102
+
91
103
SUBCOMMANDS:
92
-
forget forget a service. you can only forget a stopped service
93
-
help Prints this message or the help of the given subcommand(s)
94
-
init run in init mode, start and maintain configured services
95
-
kill send a signal to a running service.
96
-
list quick view of current known services and their status
97
-
log view services logs from zinit ring buffer
98
-
monitor start monitoring a service. configuration is loaded from server config directory
99
-
start start service. has no effect if the service is already running
100
-
status show detailed service status
101
-
stop stop service
104
+
forget forget a service. you can only forget a stopped service
105
+
help Prints this message or the help of the given subcommand(s)
106
+
init run in init mode, start and maintain configured services
107
+
kill send a signal to a running service.
108
+
list quick view of current known services and their status
109
+
log view services logs from zinit ring buffer
110
+
monitor start monitoring a service. configuration is loaded from server config directory
111
+
reboot stop all services and reboot
112
+
restart restart service.
113
+
shutdown stop all services and power off
114
+
start start service. has no effect if the service is already running
115
+
status show detailed service status
116
+
stop stop service
102
117
103
118
```
104
119
@@ -107,13 +122,16 @@ As already described above, once zinit starts in init mode, it auto monitor all
107
122
-`kill`: Similar to the unix `kill` command, it sends a signal to a named service (default to `sigterm`). If the signal terminates the service, `zinit` will auto start it since the service target state is still `up`
108
123
-`stop`: Stop sets the target state of the service to `down`, and send the `stop` signal. The stop signal is defaulted to `sigterm` but can be overwritten in the service configuration file. A `stop` action doesn't wait for the service to exit nor grantee that it's killed. It grantees that once the service is down, it won't re-spawn. A caller to the `stop` action can poll on the service state until it's down, or decide to send another signal (for example `kill <service> SIGKILL`) to fully stop it.
109
124
-`start`: start is the opposite of `stop`. it will set the target state to `up` and will re-spawn the service if it's not already running.
125
+
-`restart`: restart restarting the service. it will first try to stop and put the service status to `Down` and start it again, if it failed to stop it, it will kill the service and then start it again.
110
126
-`status`: shows detailed status of a named service.
111
127
-`forget`: works only on a `stopped` service (means that the target state is set to `down` by a previous call to `stop`). Also no process must be associated with the service (if the `stop` call didn't do it, a `kill` might)
112
128
-`list`: show a quick view of all monitored services.
113
129
-`log`: show services logs from the zinit ring buffer. The buffer size is configured in `init`
114
130
-`monitor`: monitor will load config of a service `name` from the configuration directory. and monitor it, this will allow you to add new
115
-
service to the configuration directory in runtime.
131
+
service to the configuration directory in runtime.
116
132
117
133
## Config Files
134
+
118
135
zinit does not require any other config files other that the service unit files. But zinit respects some of the global unix standard files:
136
+
119
137
-`/etc/environment` . The file is read one time during boot, changes to this file in runtime has no effect (even for new services)
0 commit comments