Rename to fsniper

Possibly rename sniper to fsniper, for "file sniper" or "filesystem sniper."

In favor:

  • dave (makes it seem more of a utility name)

Opposed:

(zarro l3ibs found)

What needs to change:

  • autotools stuff.
  • constant strings in source. this should be changed to a variable defined by autotools in config.h, some constant like PACKAGE_NAME or something. that way we can easily rename it again.

Single Sniper instance

Some apps do a thing where they make a file in /tmp which tells the pid of the program. We could make a file called /tmp/sniper-$username.pid which contains the pid number of sniper. Then, when sniper starts, it can look for this file. If it exists, it tries to see if that pid exists and is in fact sniper. If it does, simply exit?

  • If it cannot create the file, don't worry about it.
  • When sniper closes, it deletes that file.
  • If the pid exists but is not sniper, delete the file and run sniper as usual (maybe dumping info into the log).

Would we have to detect changes in pid numbers? Can that happen?

Would we want to run more than one copy of sniper, each with a different config file? Log files would fail, however. Maybe change the config directory instead of the config file so that logging still works? (e.g., sniper -c ~/.config/sniper2 changes ~/.config/sniper to ~/.config/sniper2 and the config is loaded from ~/.config/sniper2/config)

Better logging

(done in 49d3a18b5950 bla bla)

Make the time readable, and make it duplicate the output to the log to stdout if a command line option is passed.

Synchronous Mode

(done in 96ef8688 bla bla)

Make a command line switch which can disable forking/piping so it's easier to trace through with a debugger. Would've been nice along time ago.

Modification of PATH

(done in 1e0d23e bla bla)

The PATH env var should be modified to include ~/.config/sniper/scripts so no mangling has to be done with scripts that are distributed with sniper. Probably only needs to be done after a fork occurs in a handler, prior to system() being called.

Config file changes

(partially done, super concise format needs to be done still)

See ConfigFileChanges.

Implement a "delay" return code

(done in e49758f437c9 bla bla)

See DelayReturnCode.

OS specific inotify replacement

pnotify is the way.

(below here is old!) Replace the inotify specific code with a more generic function pointer based method. This would allow sniper to potentially run on Windows and OSX (and FreeBSD etc?) if a suitable equivalent can be found.

Things to check out: