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:
Joachim Nilsson committed 2015-06-08 01:07:41 +02:00
1 parent 534979e6c7
commit 720324b256
3 files changed
+14 -17

No files matched your search

+4 -4
View File
@@ -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" run [2345] @joe:users /usr/bin/logger "Hello world"
For multiple instances of the same command, e.g. a DHCP client or 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` keyword and the command, like this:
service #1 [2345] /sbin/httpd -f -h /http -p 80 -- 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 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. and only the old web server would be started and supervised.
+4 -7
View File
@@ -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 user admin
host testbed 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@eth0:222/tcp nowait [2345] /usr/sbin/sshd -i -- SSH service
inetd ssh/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. # the service/run/task keyword and the command.
service #1 [2345] /sbin/httpd -f -h /http -p 80 -- 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 service :2 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server
+6 -6
View File
@@ -506,13 +506,13 @@ void service_runlevel(int newlevel)
* when changing runlevel. * when changing runlevel.
* *
* For multiple instances of the same command, e.g. multiple DHCP * 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 :1 /sbin/udhcpc -i eth1
* service #2 /sbin/udhcpc -i eth2 * service :2 /sbin/udhcpc -i eth2
* *
* Without the #ID syntax Finit will overwrite the first service line * Without the :ID syntax Finit will overwrite the first service line
* with the contents of the second. The #ID must be [1,MAXINT]. * with the contents of the second. The :ID must be [1,MAXINT].
* *
* Returns: * Returns:
* POSIX OK(0) on success, or non-zero errno exit status on failure. * 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]; username = &cmd[1];
else if (cmd[0] == '[') /* [runlevels] */ else if (cmd[0] == '[') /* [runlevels] */
runlevels = &cmd[0]; runlevels = &cmd[0];
else if (cmd[0] == '#') /* #ID */ else if (cmd[0] == ':') /* :ID */
id = atoi(&cmd[1]); id = atoi(&cmd[1]);
else else
break; break;