0.2.6 • Published 9 years ago

singlerun v0.2.6

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

singlerun

Make sure an instance of the currently running script is only instanced once.

singlerun(killother, includeparams, mainProc)

Runs the mainProc if killother is true and is not currently running a script with the same name.

Arguments

  • killother boolean that specifies what to do if the script is already running, if true it will send a kill segterm to the other proc.
  • includeparams boolean that tells singlerung to consider the arguments of the script as part of the search of a process already running, if false it will just consider the script name; i.e. myscript.js and myscript.js --help would be different if includeparams is true.

examples

singlerun = require("singlerun")

// run script and kill any other instance of same script witouth considering the parameters for uniqueness
singlerun(true, false, function(){
	console.log "hello planet!"
});

// run script if not already running considering the parameters of the script
singlerun(false, false, function(){
	console.log "hello planet!"
});
0.2.6

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.15.324-c

9 years ago

0.15.324-a

9 years ago