{"id":13574136,"url":"https://github.com/servicer-labs/servicer","last_synced_at":"2025-04-04T14:31:46.316Z","repository":{"id":186520236,"uuid":"675275095","full_name":"servicer-labs/servicer","owner":"servicer-labs","description":"A CLI to simplify service management on systemd","archived":false,"fork":false,"pushed_at":"2024-01-23T20:19:21.000Z","size":129,"stargazers_count":441,"open_issues_count":13,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T00:24:04.218Z","etag":null,"topics":["cli","daemon","service","systemd"],"latest_commit_sha":null,"homepage":"https://servicer.dev","language":"Rust","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/servicer-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-08-06T11:34:29.000Z","updated_at":"2025-04-03T10:47:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"599e6c00-5bc8-4c9f-9bdd-7e36bbd35a0f","html_url":"https://github.com/servicer-labs/servicer","commit_stats":null,"previous_names":["servicer-labs/servicer"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servicer-labs%2Fservicer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servicer-labs%2Fservicer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servicer-labs%2Fservicer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servicer-labs%2Fservicer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/servicer-labs","download_url":"https://codeload.github.com/servicer-labs/servicer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247194122,"owners_count":20899435,"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":["cli","daemon","service","systemd"],"created_at":"2024-08-01T15:00:46.962Z","updated_at":"2025-04-04T14:31:45.899Z","avatar_url":"https://github.com/servicer-labs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# servicer: Simplify Service Management on systemd\n\n[![Crates.io](https://img.shields.io/crates/v/servicer?style=flat-square)](https://crates.io/crates/servicer)\n[![Crates.io](https://img.shields.io/crates/d/servicer?style=flat-square)](https://crates.io/crates/servicer)\n[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE-MIT)\n\n`servicer` is a user-friendly Command Line Interface (CLI) tool designed to simplify service management on `systemd`, abstracting away the complexities of the systemd ecosystem. With an easy-to-use API comparable to popular tools like pm2, servicer empowers users to create, control, and manage services effortlessly.\n\n## Key Features:\n\n1. **Intuitive CLI**: servicer provides a simple and intuitive command-line interface, making it accessible to both beginners and experienced users.\n\n2. **Service Creation**: Easily create and define new services by specifying essential details like service name, command, working directory, and environment variables.\n\n3. **Service Control**: Start, stop, restart, enable, or disable services seamlessly with straightforward commands.\n\n4. **Process Monitoring**: Monitor the status and health of services, ensuring reliable operation and automatic restarts in case of failures.\n\n5. **Service Logs**: View real-time service logs directly from the terminal to facilitate troubleshooting and debugging.\n\n6. **Cross-platform Compatibility**: servicer is designed to work on various Linux distributions with systemd support. MacOS and Windows support using `launchd` and `scm` is planned.\n\n## Goals\n\n1. **Use OS native primitives**: Unlike `pm2`, `servicer` does not fork processes nor run a custom logger. It hooks up your app into systemd and gets out of the way. Logs are handled by journald. You need not worry about your services going down if something wrong happens to `servicer`.\n\n2. **Lightweight**: Servicer is daemonless, i.e. does not run in the background consuming resources.\n\n3. **Language agnostic**: Servicer comes as a binary executable which does not require rust to be installed. There is not bloat from language exclusive features, such as `pm2` cluster mode for node.\n\n## Platform support\n\nCurrently servicer supports Linux. Systemd must be installed on the system. MacOS (launchd) and Windows (SCM) support is planned.\n\n## How do I install it?\n\n### Download binary\n\nDownload the binary from the [release page](https://github.com/servicer-labs/servicer/releases/download/v0.1.2/servicer) for run `wget https://github.com/servicer-labs/servicer/releases/download/v0.1.2/servicer`. Then setup as\n\n```sh\n# grant permissions\nchmod +rwx ./servicer\n\n# Rename to ser and make it accessable from path\nsudo mv ./servicer /usr/bin/ser\n\n# Important- symlink to node. Node must be visible to sudo user\nsudo ln -s $(which node) \"/usr/local/bin/node\"\nsudo ln -s $(which npm) \"/usr/local/bin/npm\"\n\n# This should work now\nser --help\n```\n\n### Cargo\n\n```sh\ncargo install servicer\n\n# Create a symlink to use the short name `ser`. We can now access servicer in sudo mode\nsudo ln -s ~/.cargo/bin/servicer /usr/bin/ser\n\n# Important- symlink to node. Node must be visible to sudo user\nsudo ln -s $(which node) \"/usr/local/bin/node\"\nsudo ln -s $(which npm) \"/usr/local/bin/npm\"\n```\n\n## Usage\n\nRun `--help` to display tooltip. Note that `sudo` mode is needed for most commands.\n\n### 1. Create service\n\n```sh\n# Create a service for index.js\nsudo ser create index.js\n\n# Create service, start and enable on boot\nsudo ser create index.js --start --enable\n\n# Create a service for a binary\nsudo ser create awesome-binary\n\n# Custom interpreter\nsudo ser create hello-typescript.ts --interpreter /home/hp/.config/nvm/versions/node/v20.1.0/bin/ts-node\n\n# Custom name\nsudo ser create index.js --name hello-world\n\n# Pass params to index.js by adding them after a `--` followed by space\nsudo ser create index.js -- --foo bar\n\n# Pass env variables\nsudo ser create index.js --env-vars \"FOO=BAR GG=WP\"\n\n# Enable auto-restart on exit\nsudo ser create index.js --auto-restart\n```\n\n- This creates a service file in `etc/systemd/system/hello-world.ser.service`. You must follow up with `start` and `enable` commands to start the service.\n\n- Servicer auto-detects the interpreter for `node` and `python` from $PATH available to the sudo user. You must manually provide the interpeter for other platforms using the interpreter flag, eg. `--interpreter conda`. If the interpreter is not found in sudo $PATH, run `which conda` and paste the absolute path.\n\n- You can write your own service files and manage them with `servicer`. Simply rename file to end with `.ser.service` instead of `.service`.\n\n### 2. Edit .service file\n\n```sh\nsudo ser edit hello-world\n\n# Custom editor\nsudo ser edit hello-world --editor vi\n```\n\nOpens a `.service` file in a text editor. Provides a template if the service doesn't exist.\n\n### 3. Start service\n\n```sh\nsudo ser start hello-world\n```\n\n### 4. Stop service\n\n```sh\nsudo ser stop hello-world\n```\n\n### 5. Enable service\n\n```sh\nsudo ser enable hello-world\n```\n\n### 6. Disable service\n\n```sh\nsudo ser disable hello-world\n```\n\n### 7. Delete service\n\n```sh\nsudo ser delete hello-world\n\nsudo ser rm hello-world\n```\n\n### 8. View status of services\n\nPrints PID, name, active state, enabled state, CPU and memory utilization for every service.\n\n```sh\nsudo ser status\n```\n\n```\n+-------+-------------+--------+----------------+-------+--------+\n| pid   | name        | active | enable on boot | cpu % | memory |\n+-------+-------------+--------+----------------+-------+--------+\n| 24294 | index.js    | active | false          | 0     | 9.5 KB |\n+-------+-------------+--------+----------------+-------+--------+\n```\n\n### 9. View file paths for a service\n\nFinds the `.service` and unit file path for a service.\n\n```sh\nsudo ser which hello-world\n```\n\n```sh\n+--------------+--------------------------------------------------------------+\n| name         | path                                                         |\n+--------------+--------------------------------------------------------------+\n| Service file | /etc/systemd/system/hello-world.ser.service                  |\n+--------------+--------------------------------------------------------------+\n| Unit file    | /org/freedesktop/systemd1/unit/hello_2dworld_2eser_2eservice |\n+--------------+--------------------------------------------------------------+\n```\n\n### 10. View logs\n\n```sh\nser logs hello-world\n\n# Follow live logs\nser logs hello-world --follow\n```\n\n### 11. Print contents of .service file\n\n```sh\nser cat hello-world\n```\n\n### 13. Rename service\n\n```sh\nser rename index.js hello-world\n\n# Or\nser mv index.js hello-world\n```\n\n## Quirks\n\n1. nvm: `node` is unavailable in sudo mode. You must symlink `node` to the path available to sudo. Source- https://stackoverflow.com/a/40078875/7721443\n\n```sh\nsudo ln -s $(which node) \"/usr/local/bin/node\"\nsudo ln -s $(which npm) \"/usr/local/bin/npm\"\n```\n\n## License\n\n`servicer` is licensed under the MIT license.\n\n## Disclaimer\n\n`servicer` is distributed \"as-is\" and without any warranty, expressed or implied. The authors and contributors of `servicer` shall not be held liable for any damages or losses resulting from the use or inability to use the software.\n\nBefore using `servicer`, please review the MIT License and the lack of warranty carefully. By using the software, you are agreeing to the terms of the license and acknowledging the lack of warranty.\n\n## Acknowledgements\n\nWe acknowledge all the packages and libraries used in the development of `servicer`. Their contributions have been invaluable in making this project possible. Parts of the README and codebase are generated with ChatGPT.\n\n## Contribution and support\n\nWe welcome contributions and feedback from the community. Feel free to open issues, submit pull requests, or share your thoughts on how we can improve servicer further.\n\nGet started with servicer and simplify your service management on systemd. Happy service creation!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservicer-labs%2Fservicer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservicer-labs%2Fservicer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservicer-labs%2Fservicer/lists"}