The number of seconds elapsed in the current minute given by date
is a 2-digit number. That means seconds 0 to 9 have a leading 0,
which causes them to be interpreted as octal numbers. This is not
intended, but doesn't actually break things (because 00 to 07 octal
are equivalent to 0 to 7 decimal) until second 8 or 9, at which point
we get an error because 08 and 09 are invalid octal numbers.
- Move function to show usage upon request and exit into module
- Move/create time functions
- Move function that maps module file names to module functions
- Move rpid into the module and rename it to root_pid
Make the pid parameter default to the PID of the current process.
Change the exit code for invalid arguments to a value in the user
defined range (see https://tldp.org/LDP/abs/html/exitcodes.html). This
may be considered a breaking change, but since the only applications
that currently use this script don't rely on this code, I don't think
we need to bump the major version for this.
Write the requests to all named pipes if the mod list begins with
'>>* '. This feature will probably not be merged into the main branch
because we have to search for the fifo files before each send, and if
the daemon for this login session exits, the scheduler will continue
running, which may not be desirable.
Use rpid in the daemon and the scheduler to append the PID of their
common login process to the named pipe so daemons and schedulers in
other sessions won't conflict with one another.
The daemon and scheduler will need rpid to get the PID of the login
process that they are both descended from in order to create a unique
fifo in order to not conflict with other daemons and schedulers in
other sessions.
It looks like if the daemon is started in the .xinitrc, its PID
can change once the X session is fully started. This will cause
long-running schedulers that were started along with the daemon
to not find it and exit soon after the session is started. So have
the schedulers check for the newest daemon instance each time they
are about to send it a signal. This is probably more efficient than
before when we were getting the PID once when the scheduler starts,
because the scheduler would validate that the PID still referred to
a daemon each time it sent a signal. Getting the PID replaces that
validation check, and may actually be faster.
The code for each module is wrapped in a function so the module
can be parameterized, and so its variables can be scoped to the
function. However, the function names must be unique, otherwise when
the modules are sourced, functions will overwrite functions with the
same name in previously sourced modules.
The project name is changing from status-bar to xrsb (for X root
window status bar), so the scheduler is called xrsbs.
The scheduler sends the SIGUSR1 signal to a daemon that is
responsible for maintaining and updating the status (X root window
name property). The daemon will determine which actions to perform
based on the files present in the action directory and remove the files
once the actions are performed, so the scheduler creates action files
just before sending the signal. The scheduler can send one signal to
perform multiple actions by creating multiple action files, and can
create the action file(s) and send the signal immediately,
after some delay, or repeatedly at some interval.