{"id":13624477,"url":"https://github.com/cschwarz/nsm","last_synced_at":"2025-04-23T20:28:32.404Z","repository":{"id":65465806,"uuid":"14262206","full_name":"cschwarz/nsm","owner":"cschwarz","description":"A service manager for node","archived":false,"fork":false,"pushed_at":"2014-06-26T19:40:08.000Z","size":1323,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T06:02:58.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cschwarz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-09T18:11:02.000Z","updated_at":"2025-01-27T14:42:53.000Z","dependencies_parsed_at":"2023-01-25T08:45:30.330Z","dependency_job_id":null,"html_url":"https://github.com/cschwarz/nsm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschwarz%2Fnsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschwarz%2Fnsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschwarz%2Fnsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cschwarz%2Fnsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cschwarz","download_url":"https://codeload.github.com/cschwarz/nsm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250508647,"owners_count":21442263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:42.985Z","updated_at":"2025-04-23T20:28:32.387Z","avatar_url":"https://github.com/cschwarz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"nsm - node service manager\n==========================\n\nA service manager for [node](http://nodejs.org) which makes it easy to install node.js modules as native services (daemons) on Windows, Linux and OS X.\n\nIf an installed service fails or the system has been rebooted, the service will be automatically restarted.\n\nUsage\n-----\n\n```\nnpm install -g nsm\n```\n\nA package.json with at least *name*, *description* and *main* is required in the service directory.\n\nInside the service directory use `nsm` to get a short usage description.\n\nTo install and start a service use:\n\n```\nnsm --install\nnsm --start\n```\n\nnsm requires root privileges on all platforms.\n\n## Change name/description/script/environment variables\n\n```\nnsm --install --name=anothername --script=src/server.js --env.NODE_ENV=production\nnsm --start --name=anothername\n```\n\n\nExample\n-------\n\nThis example will show you how to install a simple hello world service which crashes after a configurable amount of time.\n\nFollowing parameters can be configured in config.json:\n\n- port [8000]: port on which the service will listen\n- failAfter [45]: amount of time after which the service will throw an unhanded exception (optional)\n\nCreate a new directory named *services* (e.g.: in your home directory).\n\n```\nmkdir services\ncd services\n```\n\nInstall sample service which can be found here: [nsm-sample-service](https://npmjs.org/package/nsm-sample-service)\n\n```\nnpm install nsm-sample-service\n```\n\nMove into installed sample service directory.\n\n```\ncd node_modules/nsm-sample-service\n```\n\nInstall and start the service.\n\n```\nsudo nsm --install\nsudo nsm --start\n```\n\nGo to http://localhost:8000 to check whether the service runs. It should report the current uptime and fail after 45 seconds in the default configuration.\n\nAfter a short amount of time it should be automatically restarted.\n\nIf you make changes to your config.json you need to restart the service.\n\n```\nsudo nsm --restart\n```\n\nTroubleshooting\n---------------\n\n###Windows\n\n```\nError: Cannot find module 'npm'\n```\n\nAdd NODE_PATH (e.g.: C:\\Program Files\\nodejs\\node_modules) to your environment variables.\n\nCredits\n-------\n\nAll credit goes to [coreybutler](https://github.com/coreybutler) who has created the underlying packages ([node-windows](https://github.com/coreybutler/node-windows), [node-linux](https://github.com/coreybutler/node-linux) and [node-mac](https://github.com/coreybutler/node-mac)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcschwarz%2Fnsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcschwarz%2Fnsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcschwarz%2Fnsm/lists"}