mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Change syntax for multiple instances: #ID --> :ID
Turns out that #ID syntax for multiple instances, introduced in cb07556,
was very cumbersome to reference from the shell command line in the new
Finit client. This patch changes the syntax from #ID to :ID, which also
means that listing services/jobs in the shell will look like JOB:ID.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -214,13 +214,13 @@ the `/path/to/cmd` should be executed with. Simply prefix the path with
|
||||
run [2345] @joe:users /usr/bin/logger "Hello world"
|
||||
|
||||
For multiple instances of the same command, e.g. a DHCP client or
|
||||
multiple web servers, add `#ID` somewhere between the `run`, `task`,
|
||||
multiple web servers, add `:ID` somewhere between the `run`, `task`,
|
||||
`service` keyword and the command, like this:
|
||||
|
||||
service #1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
||||
service #2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
||||
service :1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
||||
service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
||||
|
||||
Without the `#ID` to the service the latter will overwrite the former
|
||||
Without the `:ID` to the service the latter will overwrite the former
|
||||
and only the old web server would be started and supervised.
|
||||
|
||||
|
||||
|
||||
+4
-7
@@ -1,8 +1,5 @@
|
||||
# Sample finit.conf to demonstatre the syntax
|
||||
# Sample finit.conf to demonstrate the syntax
|
||||
#
|
||||
# Comments are lines that start with #, comments are only allowed
|
||||
# on separate lines. The # sign is used inside service/run/task
|
||||
# stanzas to denote instance ID, see below.
|
||||
user admin
|
||||
host testbed
|
||||
|
||||
@@ -46,8 +43,8 @@ inetd time/tcp nowait [2345] internal -- UNIX rdate servic
|
||||
inetd ssh@eth0:222/tcp nowait [2345] /usr/sbin/sshd -i -- SSH service
|
||||
inetd ssh/tcp nowait [2345] /usr/sbin/sshd -i -- SSH service
|
||||
|
||||
# For multiple instances of the same service, add #ID somewhere between
|
||||
# For multiple instances of the same service, add :ID somewhere between
|
||||
# the service/run/task keyword and the command.
|
||||
service #1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
||||
service #2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
||||
service :1 [2345] /sbin/httpd -f -h /http -p 80 -- Web server
|
||||
service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
|
||||
|
||||
|
||||
@@ -506,13 +506,13 @@ void service_runlevel(int newlevel)
|
||||
* when changing runlevel.
|
||||
*
|
||||
* For multiple instances of the same command, e.g. multiple DHCP
|
||||
* clients, the user may enter an optional ID, using the #ID syntax.
|
||||
* clients, the user must enter an ID, using the :ID syntax.
|
||||
*
|
||||
* service #1 /sbin/udhcpc -i eth1
|
||||
* service #2 /sbin/udhcpc -i eth2
|
||||
* service :1 /sbin/udhcpc -i eth1
|
||||
* service :2 /sbin/udhcpc -i eth2
|
||||
*
|
||||
* Without the #ID syntax Finit will overwrite the first service line
|
||||
* with the contents of the second. The #ID must be [1,MAXINT].
|
||||
* Without the :ID syntax Finit will overwrite the first service line
|
||||
* with the contents of the second. The :ID must be [1,MAXINT].
|
||||
*
|
||||
* Returns:
|
||||
* POSIX OK(0) on success, or non-zero errno exit status on failure.
|
||||
@@ -558,7 +558,7 @@ int service_register(int type, char *line, time_t mtime, char *username)
|
||||
username = &cmd[1];
|
||||
else if (cmd[0] == '[') /* [runlevels] */
|
||||
runlevels = &cmd[0];
|
||||
else if (cmd[0] == '#') /* #ID */
|
||||
else if (cmd[0] == ':') /* :ID */
|
||||
id = atoi(&cmd[1]);
|
||||
else
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user