LAST EDIT=2017/02/27

This post is out of date, please see the man page
man s6opts
**************************************************************************************************************************************************************************************

An important change come with the new version of s6-boot. To follow this change a new version of s6opts was made(v0.0.4). You can find it on testing repo.
Those following lines was modified according to this.


S6opts is a helper like svopts to simplify the management of services.

https://github.com/Obarun/s6opts

Well, s6 give us more options/features than runit and it's much complex. But don't panic :), s6opts is your friend. This program will go to grow a little more again to permit some options useful like create directly a service(as svopts do). However, for the moment, this program can be used as it and works, well, like a charm :). No one is immune about bugs, so if you find one, please make a feedback :).
Don't forget to refer to the following page to know how s6 works on Obarun : http://obarun.org/forum/viewtopic.php?id=123

Well, let's go ....

S6opts come with zsh completion, don't forget to use it :
barun@ obarunS6 ~ % s6opts
s6opts command
add        -- add a service on service database
all        -- compile and switch the current database
compile    -- compile the service database
disable    -- disable a classic service from boot time
enable     -- enable a classic service at boot time
list       -- list service enabled on database for compilation
list_db    -- list of services on current database
remove     -- remove a service on service database
remove_db  -- remove a service database
switch     -- switch the current service database
verbose    -- be more or less verbose (permanent change)
which_db   -- current/previous service database used

Command add

arguments to pass :

1 arguments -> name of the directory compilation database source

zsh completion example
obarun@ obarunS6 ~ % s6opts add
choose an existing database or create a new one
base                base-graphics       base-graphics-test  default 
2 arguments -> name of the service to add

zsh completion example
obarun@ obarunS6 ~ % s6opts add base-graphics
services
all-User               connman-vpnd-log       dbus-daemon            dhcpcd-log             nfs-daemon             nfs-rpcbind-daemon     syslogds6-daemon       user-Dbus              user-Sddm                                   
boot-ready             connmand-daemon        dbus-log               lxdm-daemon            nfs-log                sddm-daemon            syslogds6-log          user-Dhcpcd            user-Syslogds6                              
connman-vpnd-daemon    connmand-log           dhcpcd-daemon          networkmanager-daemon  nfs-rpc.statd-daemon   sddm-log               user-Connman           user-Nfs   
This command we permit to add a service to a compiled database. It means, like you know, s6 works with two phase concerning service database. First, a works on offline, second, a works to update the live service database. So, add a service significate adding a service to a service database that will be compiled before using it. When you select a service, s6opts create a symlinks to the directory /etc/s6-serv/enabled/rc/source/name_of_the_db pointing to the installed service by pacman at /etc/s6-serv/available/rc. You can add a service one by one, but if you select a bundle like bundle-Dhcpcd, s6opts make all we need to enable the entire contents off the bundle. In this case s6opts will add dhcpcd-daemon, dhcpcd-log and the bundle itself bundle-Dhcpcd. So, it's up to you.

Command remove

arguments to pass :

1 arguments -> name of the database directory compilation source

zsh completion example
obarun@ obarunS6 ~ % s6opts remove
choose an existing database or create a new one
base                base-graphics       base-graphics-test  default 
2 arguments -> name of the service to add

zsh completion example
obarun@ obarunS6 ~ % s6opts remove base-graphics
services
all-User               connman-vpnd-log       dbus-daemon            dhcpcd-log             nfs-daemon             nfs-rpcbind-daemon     syslogds6-daemon       user-Dbus              user-Sddm                                   
boot-ready             connmand-daemon        dbus-log               lxdm-daemon            nfs-log                sddm-daemon            syslogds6-log          user-Dhcpcd            user-Syslogds6                              
connman-vpnd-daemon    connmand-log           dhcpcd-daemon          networkmanager-daemon  nfs-rpc.statd-daemon   sddm-log               user-Connman           user-Nfs
This command is the exact revers of add command :)

Command compile

arguments to pass :

1 arguments -> name of the database to compile
You can name the database to compile as you want or choose an existing one, or choose the current one.

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts compile
database_name
base-console             base-graphique           base-graphique-test      base-graphique-test.old  current                  default                  previous
2 arguments -> name of the database directory compilation source
This command will compile what it find at /etc/s6-serv/enabled/compiled/name_of_the_db_to_compile

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts compile base-graphique
database_name
base                base-graphics       base-graphics-test  default


Command enable

arguments to pass :

1 arguments -> name of the servcie to enable

zsh completion example
obarun@ obarunS6 ~ % s6opts enable
services
dbus    dhcpcd  mysqld  ntpd    rtkit   sshd    udisks
This command enable a service at boot time

Command disable

arguments to pass :

1 arguments -> name of the service to disable

zsh completion example
obarun@ obarunS6 ~ % s6opts enable
services
dbus    dhcpcd   sshd
This command disable a service at boot time

Command switch

arguments to pass :

1 arguments -> name of the database compiled

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts switch
database_name
base-console             base-graphique           base-graphique-test      base-graphique-test.old  current                  default                  previous 
This command allow us to switch/update the live service database. By default when s6-boot is installed, the current used database is /etc/s6-serv/enabled/compiled/Default.

It can be easy to switch between some compiled database to suit your need. For example, create a compiled database with nfs and the same compiled database less nfs. Name it as base and base-nfs, then you can switch between them to start/stop the nfs service (this is a dumb example but...:) ).
Normaly, s6 don't bring up directly the new service on the new live database used with doing a comparaison between the old and the new one, then bring up or down the service according to the difference between them.

Command all

1 arguments -> name of the compiled database
You can name the database to compile as you want or choose an existing one, or choose the current one.

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts compile
database_name
base-console             base-graphique           base-graphique-test      base-graphique-test.old  current                  default                  previous
2 arguments -> name of the database directory compilation source

This command group the command compile and switch :).

s6opts will compile the directory /etc/s6-serv/enabled/rc/source/name_of_the_db then switch the live database to the named database. In fact is a shortcut of command compile/switch :).

Command remove_db

arguments to pass :

1 arguments -> name of the database compiled

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts remove_db
database_name
base-console             base-graphique           base-graphique-test      base-graphique-test.old  current                  default                  previous
This command allow us to remove some compiled database at the directory /etc/s6-serv/enabled/rc/compiled. So, nothing special here, this is can be achieve by a rm command but with the zsh completion it's more easy :).

Command verbose

arguments to pass :

1 arguments -> a number between 0 and 3

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts verbose 
only 0,1,2, or 3 are valid
Be more or less verbose when s6opts call a command like s6-rc-update, s6-rc-change etc.. 0 mean less, 3 mean high. Your change is keeped as long as you change it again.

Command which_db

arguments to pass :

1 arguments -> let's blank
If you do not enter an arguments, the command return the current and the previous live database used.

zsh completion example
obarun@ obarunS6 [1] ~ % s6opts which_db
link_name
current   previous
Command list

arguments to pass :

1 arguments -> name of the database directory compilation source

zsh completion example
obarun@ obarunS6 ~ % s6opts list     
database_name
base                base-graphics       base-graphics-test  default 
This command permit to know which services are on a database directory compilation source.

output example :
obarun@ obarunS6 [1] ~ % s6opts list base   
all-User
boot-ready
dbus-daemon
dbus-log
dhcpcd-daemon
dhcpcd-log
user-Dbus
user-Dhcpcd
Command list_db

arguments to pass :

1 arguments -> name of the compiled database
If you do not enter an arguments, the command return the service of live database used.
zsh completion example
obarun@ obarunS6 ~ % s6opts list_db
database_name
base-console             base-graphique           base-graphique-test      base-graphique-test.old  current                  default                  previous 
This command permit to know which services are on a database directory compilation source.

output example :
obarun@ obarunS6 [1] ~ % s6opts list base   
all-User
boot-ready
dbus-daemon
dbus-log
dhcpcd-daemon
dhcpcd-log
user-Dbus
user-Dhcpcd
obarun@ obarunS6 ~ %
Well now a complete example
obarun@ obarunS6 ~ % s6opts add test bundle-Connman
obarun@ obarunS6 ~ % s6opts add test bundle-Lirc
obarun@ obarunS6 ~ % s6opts all test_compiled test
With this few command, i add the bundle-Connman, bundle-Lirc to a compiled database named test_compiled, i switch my live database to the named test_compiled and i bring up directly the new service which cannot be found on the old database.
easy, isn't it :).

oh, wait i forgot a service
obarun@ obarunS6 ~ % s6opts add test bundle-Nfs
obarun@ obarunS6 ~ % s6opts all test_compiled test
As you can see, i can compile again the same database, whatever if the database is currently used, then again s6opts bring up directly the new service which cannot be found on the old database (test.old)

grrr, why i use lirc??
obarun@ obarunS6 ~ % s6opts remove test bundle-Lirc
obarun@ obarunS6 ~ % s6opts all test_compiled test
so, now my base is complete, but i would like to quickly switch between a database containing nfs service and a another without it, so
obarun@ obarunS6 ~ % s6opts add test-Nfs bundle-Connman
obarun@ obarunS6 ~ % s6opts all test_compiled-Nfs test-Nfs

Now, i can switch easily between them
$ s6opts switch test_compiled-Nfs
So, what's else :)

Powered by Obarun