Multi-OS service manager. Create and manage services (scripts/commands) that can be executed on system startup or at regular intervals.
nazim (ناظم) means "organizer" or "manager" in Arabic — what this tool does for your system services.
Managing system services across different operating systems is boring. Each platform has its own mechanism:
- Windows: Task Scheduler
- Linux: systemd
- macOS: launchd
nazim simplifies this. It provides a unified CLI to manage services across all platforms. Write your service once, and nazim handles the platform-specific installation automatically.
flowchart LR
A[Script<br/>or Command] -->|nazim add| B[nazim]
B -->|detects platform| C{Platform}
C -->|Linux| D[systemd]
C -->|macOS| E[launchd]
C -->|Windows| F[Task Scheduler]
D --> G[Service Installed]
E --> G
F --> G
- Multi-Platform: Works on Windows, Linux, and macOS
- Startup Services: Run commands automatically on system boot
- Scheduled Execution: Execute services at regular intervals (minutes, hours, days)
- Interactive Editor: Use
--command writeto open your default editor and create scripts - Service Management: Edit, enable, disable, run, and view service status
- Automatic Logging: All service output is automatically logged to
~/.config/nazim/logs/(or%APPDATA%\nazim\logs\on Windows) - Simple CLI: Easy-to-use command-line interface
- XDG Compliant: Follows XDG Base Directory Specification for config files
- Minimal Dependencies: Uses Go standard library, YAML parser, and Windows API for UAC elevation
# Clone and build
git clone https://github.com/calilkhalil/nazim
cd nazim
make build
# Or install directly
make install-user # Installs to ~/.local/binAdd your first service:
# Simple one-liner: clean temp files every hour
nazim add --name cleanup --command "rm -rf /tmp/old_files" --interval 1h
# Or use a script file
nazim add --name backup --command backup.sh --interval 1h
# Or use interactive mode to write a script
nazim add --name myscript --command write --interval 1hgit clone https://github.com/calilkhalil/nazim
cd nazim
make build
sudo make install # System-wide installation
make install-user # User installation (~/.local/bin)go install github.com/calilkhalil/nazim/cmd/nazim@latestnazim stores service configuration in ~/.config/nazim/services.yaml (or %APPDATA%\nazim\services.yaml on Windows).
# Add a service with a simple command (oneliner)
nazim add --name "cleanup" --command "rm -rf /tmp/old_files" --interval "1h"
# Add a service with a script file
nazim add --name "backup" --command "backup.sh" --interval "1h"
# Add a service that runs on startup
nazim add --name "init" --command "init.sh" --on-startup
# Interactive mode: open editor to write script
nazim add --name "myscript" --command write --interval "30m"
# List all services
nazim list
# Remove a service
nazim remove backup
# Run a service immediately (independent of schedule)
nazim run backup
# Show service status
nazim status backup
# Or use the alias
nazim info backup# Clean up temporary files every hour
nazim add --name "cleanup-tmp" --command "rm -rf /tmp/old_files" --interval "1h"
# Run a backup command every day
nazim add --name "daily-backup" --command "tar -czf /backup/data-$(date +%Y%m%d).tar.gz /data" --interval "24h"
# Send a notification on startup
nazim add --name "startup-notify" --command "curl -X POST https://api.example.com/notify" --on-startup
# Windows: Clean temp files
nazim add --name "clean-temp" --command "del /Q C:\temp\*.tmp" --interval "30m"# Add a service that runs a script every 5 minutes
nazim add --name "monitor" --command "monitor.sh" --interval "5m"
# Add a service that runs on system startup
nazim add --name "init-script" --command "init.sh" --on-startup# Open your default editor to write a script
# The script will be saved in ~/.config/nazim/scripts/
nazim add --name "custom-task" --command write --interval "1h"# Add a service with arguments and working directory
nazim add --name "processor" \
--command "python" \
--args "process.py --verbose" \
--workdir "/opt/app" \
--interval "30m"
# One-liner with arguments (use quotes)
nazim add --name "log-analyzer" \
--command "python" \
--args "analyze.py --input /var/log/app.log --output /tmp/report.json" \
--interval "15m"# List all services with status
nazim list
# Show detailed information about a service
nazim status backup
# Or use the alias
nazim info backup
# Edit an existing service
nazim edit backup --interval 2h # Change to interval-only (disables startup)
nazim edit backup --on-startup # Change to startup-only (removes interval)
nazim edit backup --command newscript.sh # Update command only
nazim edit --name backup --interval 2h # Using --name flag
# Enable/disable services
nazim enable backup
nazim disable backup
# Remove a service (also uninstalls from system)
nazim remove monitor
# Run a service immediately (independent of schedule)
nazim run backup
# Show version information
nazim versionnazim add <options> add a new service
nazim list list all services
nazim status <name> show detailed service information (alias: info)
nazim edit <name> update an existing service
nazim remove <name> remove a service (from system and config)
nazim enable <name> enable a service
nazim disable <name> disable a service
nazim run <name> execute a service immediately (independent of schedule)
nazim version show version information
-n, --name <name>service name (required)-c, --command <cmd>command or script to execute (required) - Simple command:"rm -rf /tmp/old_files"- Script file:backup.sh- Interactive:writeoredit(opens editor)-a, --args <args>arguments for the command (space-separated)-w, --workdir <dir>working directory--on-startuprun on system startup (mutually exclusive with interval)-i, --interval <dur>execution interval (e.g., 5m, 1h, 30s) (mutually exclusive with startup)
Note: --on-startup and --interval are mutually exclusive. A service can run either on startup OR at intervals, not both.
-n, --name <name>service name (can be provided as flag or positional argument)-c, --command <cmd>update the command-a, --args <args>update arguments-w, --workdir <dir>update working directory--on-startupenable startup mode (disables interval)-i, --interval <dur>enable interval mode (disables startup)
Behavior:
- If
--on-startupis provided, the service will run only on startup (interval is cleared) - If
--intervalis provided, the service will run at intervals (startup is disabled) - If neither is provided, the current startup/interval setting is preserved
- Other fields (command, args, workdir) are only updated if explicitly provided
- Service name can be specified with
--nameflag or as a positional argument:nazim edit backupornazim edit --name backup
-v, --verboseenable verbose output-h, --helpshow help--versionshow version information
Intervals can be specified using suffixes:
30s- 30 seconds5m- 5 minutes1h- 1 hour24h- 24 hours7d- 7 days
Services are stored in YAML format at:
- Linux/macOS:
~/.config/nazim/services.yaml(or$XDG_CONFIG_HOME/nazim/services.yaml) - Windows:
%APPDATA%\nazim\services.yaml
Scripts created via --command write are stored in:
- Linux/macOS:
~/.config/nazim/scripts/ - Windows:
%APPDATA%\nazim\scripts\
Service logs are automatically stored in:
- Linux/macOS:
~/.config/nazim/logs/ - Windows:
%APPDATA%\nazim\logs\
Example configuration:
- name: backup
command: backup.sh
interval: 1h
enabled: true
platform: linux
- name: init-script
command: init.sh
on_startup: true
enabled: true
platform: linuxNote: on_startup and interval are mutually exclusive. A service can have either on_startup: true OR an interval, but not both.
| Variable | Description | Default |
|---|---|---|
NAZIM_VERBOSE |
Enable verbose output | (unset) |
EDITOR |
Default editor for interactive mode | Platform-specific (vim, nano, notepad, etc.) |
VISUAL |
Alternative editor variable | Same as EDITOR |
XDG_CONFIG_HOME |
Config directory | ~/.config (Linux/macOS), %APPDATA% (Windows) |
When using --command write or --command edit, nazim will:
- Create a script template with:
- Service name clearly marked
- Section marked "YOUR CODE HERE" where you write your logic
- Examples and comments to guide you
- Proper shebang/header for your platform
- Open your default editor (from
$EDITORor$VISUALenv vars) - Save the script in
~/.config/nazim/scripts/(or equivalent) - Use the appropriate extension (
.shon Linux/macOS,.baton Windows) - Make the script executable automatically
Template Structure:
- Header with service name, creation date, and location
- Clear section marked "YOUR CODE HERE" for your code
- Examples of common commands
- Proper exit codes
The editor priority:
$EDITORenvironment variable$VISUALenvironment variable- Platform defaults:
vim,nano,code(VS Code), ornotepad(Windows)
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error |
- Uses Task Scheduler (
schtasks) for service management - Supports startup and scheduled execution
- Services are prefixed with
Nazim_in Task Scheduler - Automatic UAC elevation when needed for service installation/management
- Uses systemd (user services) exclusively
- Requires systemd to be available (most modern Linux distributions)
- Services are created in
~/.config/systemd/user/ - Uses systemd timers for scheduled execution
- Uses launchd for service management
- Services are created in
~/Library/LaunchAgents/ - Supports startup and interval-based execution
- Add Service: nazim validates the service configuration and saves it to YAML
- Install: nazim creates the appropriate platform-specific service:
- Windows: Task Scheduler entry (with automatic log redirection)
- Linux: systemd service/timer (with automatic log redirection)
- macOS: launchd plist file (with automatic log redirection)
- Logging: All service output (stdout and stderr) is automatically redirected to log files in
~/.config/nazim/logs/(or%APPDATA%\nazim\logs\on Windows) - Manage: You can list, run, edit, enable, disable, or remove services through the CLI
- Remove: nazim uninstalls the service from the system, removes it from config, and deletes associated script files (if created via
writecommand)
- Go 1.24.0 or higher (for building from source)
- Administrator/root permissions (for installing system services)
- Platform-specific tools:
- Windows:
schtasks - Linux:
systemctl - macOS:
launchctl
- Windows:
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
MIT License - see LICENSE file for details.