


bin: It is a short form for binary files.
#Find any file unix plus
In any case, make it easy (command-line option, plus perhaps a compile-time option) for the distributor or administrator to change the pidfile location. Otherwise, pick a location under /tmp or /var/tmp, but this introduces additional complexity because the pidfile's name can't be uniquely determined if it's in a world-writable directory. Note that the root part of the launcher, or a boot script running as root, needs to create the directory (for a human user, the directory is created when the user logs in). On many modern Linux systems, if you start the daemon from a script or launcher that isn't running as root, you can put the pidfile in /run/user/$UID, which is a per-user equivalent of the traditional /var/run. If you start your daemon from a script that's running as root, have it create a subdirectory /var/run/gmooredaemon and chown it to the daemon-running user before suing to the user and starting the daemon. Most unices will clean this directory on boot under Ubuntu this is achieved by /var/run an in-memory filesystem (tmpfs). The normal location for pidfiles is /var/run. This directory could be mounted read-only, could be shared between machines, could be watched by a daemon that treats any change there as a possible break-in attempt… I wouldn't put a pidfile under an application installation directory such as /opt/my_app/whatever. If failed port 21 protocol ftp then alert Must my pidfile be located in /var/run? You can refer to this below example: Monitor vsftpd Moreover, if you want to check specific process and you don't have it is pid file, you can use matchproc to match the process instead of using it pid file or you have to create a pid file manually.

I believe that files under /var/run are often handled by the distro maintainers rather than daemons' authors, since it's the distro maintainers' responsibility to make sure that all of the init scripts play nice together. This Perl library might be helpful, since it looks like the author has at least given thought to some issues than can arise. The closest I could find is this section of the Filesystem Hierarchy Standard. Reference for proper handling of PID file on UnixĪs far as I know, PID files are a convention rather than something that you can find a respected, mostly authoritative source for. apache2ctl) know what process to send signals to.

They can also be used so that control processes (e.g. For example, they can be used to prevent a process from running more than once. pid files are often used by daemon processes for various purposes. The latter holds true - a process must create the. You can also use that information to kill the process yourself, using cat filename.pid | xargs kill Unix. For example, Apache HTTPD may write its main process number to a pid file - which is a regular text file, nothing more than that - and later use the information there contained to stop itself. The pid files contains the process id (a number) of a given program.
