Skip to content

Commit dc5b3f6

Browse files
authored
Merge pull request #40 from jfsmig/M-doc-20200120
Fix the doc
2 parents a0abf95 + 13ae5d5 commit dc5b3f6

File tree

4 files changed

+71
-42
lines changed

4 files changed

+71
-42
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
sudo: required
2-
dist: trusty
2+
dist: bionic
33
language: c
44
install:
55
- sudo apt-get install -y --force-yes gcc make cmake libglib2.0-dev

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Gridinit is a tool used to manage non-daemon processes.
44

55
## Build
66

7+
```
8+
cmake -D GRIDINIT_SOCK_PATH=/tmp/gridinit.sock .
9+
make
10+
```
11+
712
### Dependencies
813

914
* cmake, make, gcc
@@ -16,3 +21,18 @@ Gridinit is a tool used to manage non-daemon processes.
1621
| ----- | ------- | ----------- |
1722
| GRIDINIT_SOCK_PATH | /var/run/gridinit.sock | Path used for the socket on both server and client side, when no path is specified in the configuration. |
1823

24+
## Try it
25+
26+
```
27+
./gridinit -d ./gridinit.conf
28+
./gridinit_cmd status
29+
./gridinit_cmd status2
30+
./gridinit_cmd status3
31+
./gridinit_cmd status @NS0
32+
./gridinit_cmd status @NS1
33+
./gridinit_cmd status @local
34+
./gridinit_cmd status @local @NS1 @NS0
35+
./gridinit_cmd stop
36+
./gridinit_cmd start
37+
```
38+

gridinit.conf

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
[Default]
2-
#listen=/var/run/gridinit.sock
3-
pidfile=/var/run/gridinit.pid
2+
# Default:listen GRIDINIT_SOCK_PATH
3+
listen=/tmp/gridinit.sock
4+
5+
# No default value
6+
# Specify a path to let gridinti write its pid file.
7+
pidfile=/tmp/gridinit.pid
48

59
# Default:uid : STRING | INTEGER
610
# The default user ID to be applied to services. You can use even
7-
# a logical name or its ID.
11+
# a logical name or its ID.
812
uid=root
913

1014
# Default:gid : STRING | INTEGER
1115
# The default group ID to be applied to services. You can use even
12-
# a logical name or its ID.
16+
# a logical name or its ID.
1317
gid=root
1418

1519
# Default:include : PATTERN
@@ -43,59 +47,64 @@ limit.core_size=-1
4347
limit.max_files=8192
4448

4549
# Default:limit.stack_size : INTEGER
46-
# Default maximal thread stack size in kilobytes for each
50+
# Default maximal thread stack size in kilobytes for each
4751
# Default value : 1024
4852
limit.stack_size=1024
4953

50-
# Default:groups_only : STRING[,STRING]...
51-
# Set this variable if you want to filter the services. Only those
52-
# matching one of the given groups will be considered by CLI
53-
# start/stop commands
54-
groups_only=NS-common,NS-stgdev
5554

56-
[service.key0]
55+
[service.key-down]
56+
# group : STRING [ "," STRING ]...
57+
# A coma-separated sequence of tokens. Each tokens is the name of a
58+
# group the current service belongs to. It is usefull to have the commands
59+
# target many services at once, when specifying @groups instead of services
60+
# IDs.
61+
group=NS0,local
62+
63+
# The command to be executed.
64+
command=/bin/sleep 15
5765

58-
# group : STRING
59-
# Optional configuration directive setting an arbitrary tag on the
60-
# service. This tag allows start/stop CLI commands to work on the current
61-
# service when an argument with the form '@STRING' is present and STRING
62-
# matches the current service's group.
63-
group=NS0
66+
# Supersedes the default env variale with the same key.
67+
env.PATH=/bin:/usr/bin:/usr/local/bin
6468

65-
# command : STRING
66-
# Mandatory Directive
67-
command=gridinit_testcmd /tmp/key0.out 5
69+
# Supersedes the default env variale with the same key.
70+
env.LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
6871

6972
# enabled : BOOL
70-
# Optional directive telling if the service is allowed to start.
71-
# A disabled service cannot be started even if start CLI commands
72-
# are sent.
73+
# Tells gridinit to consider (or not) that section in the configuration.
7374
enabled=true
7475

75-
# on_die : 'cry' | 'respawn'
76-
# Optional and dangerous directive telling what to do with the whole
77-
# gridinit when the current service dies, whatever the normality of
78-
# the death.
76+
# on_die : "respawn" | "cry"
77+
# Tells what to do when the child dies.
78+
# - "respawn": it will be respawn N times (after N attempts, it will be
79+
# considered BROKEN and it will have to be repaired.
80+
# - "cry": an alert will be logged, and that's it.
7981
on_die=respawn
8082

81-
# env.STRING : STRING
82-
#
83-
env.PATH=/bin:/usr/bin:/usr/local/bin
84-
env.LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
85-
86-
# uid : STRING | INTEGER
87-
# Ignored if the gridinit uid is not 0
88-
uid=root
89-
90-
# gid : STRING | INTEGER
91-
# Ignored if the gridinit uid is not 0
92-
gid=root
93-
9483
# start_at_boot : BOOL
9584
# Optional, default: true
9685
# Tells if the service has to be started when it is met for the first
9786
# time (i.e. not changed if the service is refreshed after a configuration
9887
# reload). 'start_at_boot' is overriden by 'enable' or CLI 'start' and
9988
# 'stop' commands.
89+
start_at_boot=false
90+
91+
92+
[service.key-disabled]
93+
group=NS0,local
94+
command=/bin/sleep 15
95+
enabled=false
96+
on_die=respawn
97+
env.PATH=/bin:/usr/bin:/usr/local/bin
98+
env.LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
99+
start_at_boot=true
100+
101+
102+
[service.key1]
103+
group=NS1,local
104+
command=/bin/sleep 25
105+
enabled=true
106+
on_die=respawn
107+
env.PATH=/bin:/usr/bin:/usr/local/bin
108+
env.LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
100109
start_at_boot=true
101110

main/gridinit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ static void
13361336
__parse_options(int argc, char ** args)
13371337
{
13381338
GError *error_local = NULL;
1339-
GOptionContext *context = g_option_context_new(" CONFIG_PATH [LOG4C_PATH]");
1339+
GOptionContext *context = g_option_context_new(" CONFIG_PATH");
13401340
g_option_context_add_main_entries(context, entries, NULL);
13411341
if (!g_option_context_parse(context, &argc, &args, &error_local)) {
13421342
g_print("option parsing failed: %s\n", error_local->message);

0 commit comments

Comments
 (0)