Codjixd is a lightweight and flexible service manager for Linux systems and Docker containers.
- Start, Stop, Restart: Manage services with simple commands.
- Status, List: Simple metrics-like status, list all services.
- Defination, Configs: Easy to define and configure services.
- Dependency Management: Automatically start dependent services.
- Health Checks: Define custom health checks for services.
- Log Rotation: Automatically rotate logs for better management.
- Run anywhere: As a plain script it can run on any Linux system.
- It requires
bashto run. Make sure you have it installed. - On busybox-based systems, you need to install the full:
procpsit is required to work properly.lessit is optional to get live logs.
apk add bash procps less# 1. Get the script:
wget https://dub.sh/codjixd -O codjixd.sh
# 2. Make it executable:
chmod +x codjixd.sh
# 3. Add script to $PATH:
sudo mv codjixd.sh /usr/bin/codjixd
# 4. Final setup:
mkdir -p /opt/codjixd/services
sudo chown -R $USER /opt/codjixddocker pull codjix/codjixd:latestUsage: codjixd <command> [<service>]
Commands:
start <service> Start a service
stop <service> Stop a service
restart <service> Restart a service
kill <service> Kill a service and its dependencies
status <service> Show status and metrics for a service
logs <service> Tail logs for a service
list, ls List all available services
version Show version information
help Show this help message
Options:
-v, --version Show version information
-h, --help Show this help message
Codjixd uses a configuration file located at /etc/codjixd.conf. You can customize the following variables:
BASE_DIR="/opt/codjixd" # Base directory for logs, PIDs, and services
LOG_DIR="$BASE_DIR/logs" # Directory for service logs
PID_DIR="$BASE_DIR/pids" # Directory for PID files
SERVICES_DIR="$BASE_DIR/services" # Directory for service scriptsTo create a service for Codjixd, follow these steps:
-
Create a Service Script:
- Place your service script in the
servicesdirectory (default: /opt/codjixd/services). Serivce nameis considered as the script name without ".sh" extension so keep it simple.- The script must has a
start_fnfunction, which contains the logic to start the service. - Optionally, you can define a
health_checkfunction for custom health checks and adepend_onarray for service dependencies.
- Place your service script in the
-
Example Service Script:
#!/bin/bash
# Dependencies (optional)
depend_on=("service_1" "service_2" "service_3")
# Start function (required)
# This function should run as a daemon(does not exit)
start_fn() {
echo "Starting my_service..."
# Add your service start logic here
while true; do
echo "my_service is running..."
sleep 10
done
}
# Health check function (optional)
health_check() {
# Add your health check logic here
if curl -s http://localhost:8080/health > /dev/null; then
return 0
else
return 1
fi
}Contributions are welcome! Please read the Contributing Guidelines for details.
Codjixd is licensed under the MIT License. See LICENSE for more details.