66-scandir handle a scandir for a specific given user. It is designed to be either the root or a branch of a supervision tree.
66-scandir [ -h help ] [ -v verbosity ] [ -b boot ] [ -l live ] [ -t rescan ] [ -f finish command ] [ -e environment ] [ -c create ] [ -r remove ] [ -u up ] [ -d signal ] owner
66-scandir will handle or create the scandir at live for a specific owner depending of the options given. The owner can be any valid user on the system. However, the owner must have sufficient permissions to create the necessary directories at live. If the owner is not set, the user of the current process will be took.
The options -s to send a signal to the scandir is builded
around the s6-svscanctl
program and act with exactly the same behaviour. Any signal accepted by
s6-svscanctl program can be passed but need to be done without the '-'
character at the begin of the signal. If, for example, you want to send a -t
signal you need to use: 66-scandir -s t. Series of command is also accepted
in the same manner: 66-scandir -s st.
Also some convenient sentence was added to avoid to remember basic and usefull series
of command like :
66-scandir -s reload
Updates the process supervision tree to exactly match the services listed in scandir.
This command is strictly equal to :
s6-svscanctl -an /service
When you ask for a creation of the scandir various files and directories will be created at live directory for the given owner. If you run the 66-scandir with the user root, you will find in /run/66 (default directory is took for the example) :
If you ask for the creation of the scandir with normal user you will find /run/66/scandir/1000 where 1000 is the corresponding uid for the user, and /run/66/tree/1000. The log directory is not set due of the missing permissions to create the scandir for the boot process, instead it will be found by default at /var/log/scandir-1000. Default log directory can be changed at compile-time by giving the --with-system-logpath=DIR option for root permissions and --with-user-logpath=DIR options for user permissions to ./configure.
An existing scandir directory will be used as it and the creation will be skipped. If you want to create a fresh scandir directory for the same owner, use the -r options before.
s6-svscan program expect to find some control file when it receive a signal. Thoses files are not mandatory and are not created by any s6 program but are usefull to control the e.g shutdown process. The 66-scandir program will care of it and create those files at /run/66/scandir/0/.s6-svscan directory. Depending if the -b options is passed or not to the command line, the files will change.
With the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env redirfd -r 0 /dev/console redirfd -w 1 /dev/console fdmove -c 2 1 s6-echo -- "scandir /run/66/scandir/0 crashed...
without the -b option
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env foreground { 66-all -v3 -l /run/66/ down } s6-echo -- "scandir /run/66/scandir/0 crashed..."
With the -b options the file will be:
#!/usr/local/bin/execlineb -S0 fdmove -c 2 1 s6-envdir .env cd / redirfd -w 2 /dev/console fdmove -c 1 2 foreground { s6-svc -X -- /run/66/scandir/0/scandir-log } unexport ? wait r -- { } /etc/66/stage3 $@
The last command (in our example /etc/66/stage3 @) is set by the -f finish command options given on the command line. If your e.g finish command is /usr/bin/true your finish file will be:
#!/usr/local/bin/execlineb -S0 fdmove -c 2 1 s6-envdir .env cd / redirfd -w 2 /dev/console fdmove -c 1 2 foreground { s6-svc -X -- /run/66/scandir/0/scandir-log } unexport ? wait r -- { } /usr/bin/true
without the -b option
#!/usr/local/bin/execlineb -S0 fdmove -c 2 1 s6-envdir .env s6-echo -- "scandir /run/66/scandir/0 shutted down..."
With or without the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env foreground { 66-dbctl -v3 -l /run/66/ -d Master } s6-svscanctl -h .
With or without the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env foreground { 66-all -v3 -l /run/66/ down } s6-svscanctl -6 .
With or without the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env foreground { 66-all -v3 -l /run/66/ down } s6-svscanctl -7 .
With or without the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env foreground { 66-all -v3 -l /run/66/ down } s6-svscanctl -t .
With or without the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env s6-svscanctl -an .
With or without the -b options the file will be:
#!/usr/local/bin/execlineb -P fdmove -c 2 1 s6-envdir .env foreground { 66-all -v3 -l /run/66/ down } s6-svscanctl -0 .
name of the file: /etc/66/env/TZ
contain of the file:
Pacific/Noumea
Every daemon launched on the scandir should inherit of the environment variable of the scandir. So if you want to have a specific key=value pair for every daemon, use this option.
When you use the -r options some directories of the scandir will be removed but not all the componments of the directory. In our previous example:
The root live (a.k.a /run/66) directory will be not removed because an another user can still use it. In fact the 66-scandir will only remove the componment of the corresponding uid of the owner.
An running scandir can not be removed. You must stop the scandir before to be able to remove it.