{"id":20208169,"url":"https://github.com/cubiclesoft/service-manager","last_synced_at":"2025-04-10T12:54:36.700Z","repository":{"id":145129958,"uuid":"59030751","full_name":"cubiclesoft/service-manager","owner":"cubiclesoft","description":"The world's first cross-platform, open source (MIT or LGPL), programming AND scripting language-agnostic solution to system service development.  Source code:","archived":false,"fork":false,"pushed_at":"2022-12-29T14:43:51.000Z","size":1093,"stargazers_count":41,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T11:38:48.147Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/cubiclesoft/service-manager-src","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cubiclesoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-17T14:40:03.000Z","updated_at":"2025-03-10T15:58:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"552fa571-87c4-459a-b975-c01025b69b18","html_url":"https://github.com/cubiclesoft/service-manager","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/cubiclesoft%2Fservice-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fservice-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fservice-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cubiclesoft%2Fservice-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cubiclesoft","download_url":"https://codeload.github.com/cubiclesoft/service-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248221519,"owners_count":21067570,"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-11-14T05:34:24.850Z","updated_at":"2025-04-10T12:54:36.693Z","avatar_url":"https://github.com/cubiclesoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Service Manager (Official binaries)\n===================================\n\nThe world's first cross-platform, open source (MIT or LGPL), programming AND scripting language-agnostic solution to system service development.\n\nIf you want to look at or change the source code or compile the binaries for yourself, go here:\n\nhttps://github.com/cubiclesoft/service-manager-src\n\nFeatures\n--------\n\n* Statically compiled targets for Windows, Mac, and Linux (32-bit and 64-bit).\n* Natively supports these common service commands across all platforms:  install, uninstall, start, stop, restart, reload, status, waitfor, configfile, run, and custom actions.\n* Also has a few per-platform options (e.g. win_priority, nix_user, nix_group).\n* Nifty stuff:  Automatic restart if the service dies, handling system signals on appropriate platforms, etc.\n* Has a liberal open source license.  MIT or LGPL, your choice.\n* Sits on GitHub for all of that pull request and issue tracker goodness to easily submit changes and ideas respectively.\n\nIntro Video\n-----------\n\nWatch the YouTube intro video:\n\n[![Click to watch:  Introduction to Service Manager](https://img.youtube.com/vi/HobVSLiTDEI/0.jpg)](https://www.youtube.com/watch?v=HobVSLiTDEI \"Click to watch:  Introduction to Service Manager\")\n\nIt's got music and a pretty solid Aussie accent.  It is also only 5 minutes long.\n\nHow To Use Service Manager\n--------------------------\n\nService Manager is a native executable that talks platform-specific language to manage services for the platform.  All of the available options can be viewed by running the executable without any options:\n\n````\nSyntax:\n\nservicemanager.exe [options] action service-name\n                   [[NotifyFile | CustomActionName CustomActionDescription]\n                    ExecutableToRun [arguments]]\n\nUse an English, hyphenated, lowercase name for 'service-name' to maximize\ncompatibility across platforms.\n\n\nActions:\n\ninstall\n        Install service/daemon.\n        Requires NotifyFile and ExecutableToRun.\n        'NotifyFile.stop' will be created when the process needs to stop.\n        'NotifyFile.reload' will be created when the process needs to\n        reload its configuration.\n\nuninstall\n        Uninstall service/daemon.\n\nstart\n        Start service manager and service/daemon.\n\nstop\n        Stop service manager and service/daemon.\n        Process is responsible for noticing the 'NotifyFile.stop' file\n        and exiting in a timely manner.\n\nrestart\n        Restart service/daemon.\n\nreload\n        Reload service/daemon.\n        Process is responsible for deleting the 'NotifyFile.reload'\n        file when the configuration has been reloaded.\n        If the process is unable to support reloading, it must\n        self-terminate.\n\nwaitfor\n        Waits for the specified service manager service to start.\n        Useful for handling dependencies inside the service itself.\n\nstatus\n        Retrieve basic service manager information.\n\nconfigfile\n        Outputs the location of the server manager configuration file.\n\nrun\n        Runs the service.\n        Most useful when -debug is specified, which runs the service as\n        a simple console/terminal application.\n\naddaction\n        Adds a custom service manager action.\n        Useful for actions such as 'configtest'.\n        Requires CustomActionName, CustomActionDescription, and\n        ExecutableToRun.\n\n\nOptions:\n\n-pid=File\n        Writes the process ID of this executable to the specified file.\n        Install and run only.\n\n-log=File\n        Writes management information (start, stop, reload, etc.) to the\n        specified log file.  You are on your own for log rotation.\n        Install and run only.\n\n-wait[=Milliseconds]\n        The amount of time, in milliseconds, to wait for the process to\n        complete an operation before forcefully terminating the process\n        after creating the appropriate NotifyFile.\n        The default behavior is to wait indefinitely.\n        Install and run only.\n\n-dir=StartDir\n        Sets the starting directory of the new process.\n        Install and run only.\n\n-debug\n        Enables console/terminal mode.  Run only.\n````\n\nFor Windows, Service Manager is a bit redundant.  [SrvAny](https://support.microsoft.com/en-us/kb/137890) and [NSSM](https://nssm.cc/) are two commonly referenced tools.  Service Manager is a unified cross-platform interface - write once, run everywhere.\n\nFor Mac, Linux, and most *NIX variants, the binaries are accompanied with basic text files (e.g. 'servicemanager_nix.sysvinit').  These text files contain tokens that get replaced with the Service Manager executable location and the name of the service, which are then stored in system directories such as /etc/init.d/ to be run/processed during system startup so that the service starts at boot.\n\nService Manager stores configuration files in a global location on the system to provide reliable, consistent configuration of services.  You can find the location of the configuration file of any Service Manager enabled service by using the 'configfile' action.\n\nHow To Write A Service\n----------------------\n\nYour service has to watch for the existence of two files.  These notification files are '\\[something\\].reload' and '\\[something\\].stop'.  You specify, during installation, what the \"\\[something\\]\" is.  (If you use an SDK, there will be a reliable, standard mechanism.)  The easiest solution here is to use your service's directory and filename as the base.  Most languages can locate their own executables and scripts in the file system (e.g. PHP has \\_\\_FILE\\_\\_).\n\nIdeally, there is a helper SDK for your favorite language.  If not, no worries.  The only real benefits of an SDK are ease of installation and removal and simple access to the service manager configuration for your service as well as selecting the correct executable to run for the platform.  You can always do a manual installation with slightly longer command-lines.\n\nSee an example service written in PHP using the PHP SDK [here](https://github.com/cubiclesoft/service-manager-src/blob/master/test_service.php).\n\nHow To Debug A Service\n----------------------\n\nOne of the really nice features of Service Manager is that you don't need it to debug your service.  Just run your app normally from a command-line and use Ctrl+C to terminate it.\n\nThat said, sometimes things can work fine from a command-line but not so fine as a system service.  The Service Manager '-debug' 'run' action takes most of the same options as the 'install' action and then replicates some of the service environment without detaching from the terminal/shell/command prompt.  Doing this allows you to see debug output as it happens to figure out what is wrong.\n\nPrecompiled Binaries\n--------------------\n\nPrecompiled binaries save the compilation step for select, popular architectures.  Currently, there are binaries for:\n\n* Windows - Anything current, x86/x64 (i.e. 32-bit and 64-bit).\n* Mac - x64 only (i.e. 64-bit Intel).\n* Linux - x86/x64.\n\nThe binaries included in this repo are just meant to make most deployments easier since they aren't particularly big (~130KB each).\n\nFor other architectures (e.g. Linux on ARM), [building and installing from the source code](https://github.com/cubiclesoft/service-manager-src#building-and-installing-locally) is a good option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubiclesoft%2Fservice-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcubiclesoft%2Fservice-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubiclesoft%2Fservice-manager/lists"}