Sample is the missing link in the POSIX-compliant cron-family of task scheduling tools. The project monitors files on a user-by-user basis and waits for their timestamp/filesize to hit a threshold thereby executing a specified command to handle the files.
Here are some key features of "Sample":
· POSIX-compliant, portable on unix-based systems.
· Simple, easy to understand syntax and quick to learn.
· Versatile, capable for use in many situations.
· Fast, run quickly and restricted if need be.
· Small, leave a small footprint in memory and execution.
· Expandable, can grow without changing the core syntax.
· Secure, as much as possible running arbitrary commands.
Sample will only "sample" matched files if the active user has _write_access to the file and it does not contain non-printable characters, it will not process the matched file at any level otherwise.
Sample will only process unique users with unique home directories, this is done on a first-come frist-serve basis. So, if a user or home directory is first in the /etc/passwd file (including network users) and another entry has the same user or home directory that other user will not be processed at any level.
To install sample, follow the usual steps:
# cd sample-VERSION/
On most systems, simply:
On OSX, /usr/bin/sample already exists, so use the following to rename sample/samples/sampled to fsample/fsamples/fsampled:
# ./configure --enable-f-prefix
# make install
Start the daemon, this will need to be placed in your rc script(s) as well.
This can also be launched by directly executing "/path/to/sampled":
# samputil start
As a user, to edit your ~/.sample file (with validation/etc):
To test if the sample daemon (sampled) is running properly for the active user run the following set of commands. It will attempt to delete ~/testfile if the file modification time is older than 1 second (essentially immediately). Sampled processes every minute, on the minute, so the file
should disappear right around when the system clock hits :00 seconds.
$ touch ~/testfile
$ samples add ~/testfile M 1s "rm -f %s"
What's New in This Release:
· Changed support for configure's --prefix argument. If supplied, will now place all sample-related files inside that prefix directory. If the argument is not supplied sample-related files will be placed in an assumed "best" standard place ("--prefix" is the only generic configure option used)
· Added "%i" inode string replacement variable for commands.