module

Thyme::ProcessHandler

Handles all things related to PID!

The Thyme timer runs as a daemon process. Stopping/pausing/unpausing are all initiated by a secondary process. It sends a signal to the main daemon. In order to do so, it needs the daemon's PID which is stored in the PID_FILE.

See Thyme::SignalHandler for the actual message sending. This module only deals with reading/writing the daemon's PID.

Constants

PID_FILE = "#{ENV["HOME"]}/.thyme-pid"

Instance methods

delete_pid

Clean up by removing PID_FILE.

read_pid

Returns the PID of the main daemon process. Should only be used by the secondary processes (eg during stopping/pausing/unpausing).

running?

Returns true if main daemon is running.

write_pid

Writes the current process's PID to the PID_FILE. Must only be used by the main process. Must never be used by secondary processes.