Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Writes the PID to a lock file and then switches the owner of the process
Shell JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
centos5_start_script
package.json
pid_write.js
test.js

README.md

pid_write

Install: npm install pid_write

-- still in development so use at own risk.

Writes the PID to a lock file and then switches the group and owner of the process

I wanted to be able to use a system 5 startup script for Centos5 to control my application. I was having issues with user permissions and some Linux security stuff around user and program managment.

  1. Writing a PID file is only allowed by the root user
  2. I want the program to run as not root

Usage example:

var pw = require('./pid_write');

try{
    var pid = pw.pid_write('./pidfile', 'swright', 'swright');
    console.log(pid);
}catch(e){
    console.log('Exception:' + e);
}

ToDo:

  1. Find a way to have the pid file name and user given in the startup script and pid_write() to be sourced from one location to be nice and DRY
Something went wrong with that request. Please try again.