ServoOps is a Web API project written in Go using the Gin framework. The API provides endpoints to manage and monitor system services.
- List all running services with their PID, name, user, memory usage, CPU usage, and start time.
- Kill a service by its PID.
- Start a system service.
- Stop a system service.
- Health check endpoint to ensure the API is running.
- Basic authentication middleware.
- Logging middleware to log request details.
- Clone the repository:
git clone https://github.com/yourusername/yourrepository.git
- Navigate to the project directory:
cd yourrepository
- Run the application:
go run main.go
GET /services
: List all running services.DELETE /services/:id
: Kill a service by its PID.POST /services/start/:name
: Start a system service by its name.POST /services/stop/:name
: Stop a system service by its name.GET /health
: Health check endpoint.
- The API uses basic authentication with the secret token
c2FubWFyZwo=
.
- Request details are logged using the logging middleware.
- Start the API.
- Use the provided endpoints to manage and monitor system services.
Here is an example of how to use the API endpoints:
curl -H "Authorization: c2FubWFyZwo=" http://localhost:8082/
curl -X DELETE -H "Authorization: c2FubWFyZwo=" http://localhost:8082/services/1234
curl -X POST -H "Authorization: c2FubWFyZwo=" http://localhost:8082/services/start/servicename
curl -X POST -H "Authorization: c2FubWFyZwo=" http://localhost:8082/services/stop/servicename
- Fork the repository.
- Create a new branch:
git checkout -b feature
- Make your changes and commit them:
git commit -m 'Add new feature'
- Push to the branch:
git push origin feature
- Submit a pull request.
- This project is licensed under the MIT License - see the LICENSE file for details.