Skip to content

(NPM) Package that return true to one cluster proccess, working with Cronjobs.

License

Notifications You must be signed in to change notification settings

jwmrf/cluster-cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

one-cluster

Package with identify the principal process id in a clustering application or work without cluster normally.

Installation

npm install one-cluster

Use Function

const onecluster = require('one-cluster')
onecluster() 'Return True if application not have cluster or if is the principal(id 1) process in a cluster application'

onecluster(2) 'You can select the Cluster Process ID to identify' 
'The Major Cluster Process is id 1, for each process the id increment is 1.'
'If you have 3 process, the ids are 1 - 2 - 3'

Use With Cronjob Example

npm install cron
const onecluster = require('one-cluster')
var CronJob = require('cron').CronJob;
var job = new CronJob('* * * * * *', function() {
    if(onecluster()){
        console.log('You will see this message in one cluster process');
    }
}, null, true, 'America/Los_Angeles');
job.start();

About

(NPM) Package that return true to one cluster proccess, working with Cronjobs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published