utlogd

Software

obarun.org

utlogd

An utmp login/logout user daemon tracker.

Interface

    utlogd [ -h ] [ -v verbosity ] [ -d notif ]

Utlogd wait for event at the /run/utmp file and react on this event by launching all scripts found at /var/lib/utlogd/<username>/login user login and at /var/lib/utlogd/<username>/logout user logout.

The user needs to first be activated by the intermediate of the utlogctl software. If the user is not activated, utlogd send a message to stderr and do nothing.

The default path for the utmp file and the main script directories can be changed at compile time by passing the --utmp-path=DIR and --script-path=DIR respectively to ./configure.

This daemon is intended to be launched under a supervison suite like s6.

Utlogd never polls. It uses the inotify API to survey the /run/utmp file.

If the utmp file is removed from the system while utlogd is running, it crashes and exits 111.

Exit codes

Options

Scripts execution

The scripts must be executables.

Scripts launched by utlogd at a user event, is executed with the ownership of these files. It tries to use the setuid and setgid system call with the corresponding uid and gid of the script file. If that process fails, it sends a message to the stderr, ignore the script and passes to the next script to launch.

If the scripts cannot be launched for any reason, utlogd sends a message to stderr and passes to the next script to launch.

Before launching the scripts, utlogd sets the environment variable USER to the currently handled user.