Skip to content

49mg/ops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🆘 OPS — Oh Please, Save-me

A lightweight C-based Linux CLI tool to rescue your systemd logs before they rescue you.

OPS is a fast, secure, and minimal Linux CLI utility written in C, designed for system administrators who just want their journalctl logs — quickly, safely, and without drama.

Whether you want to view logs directly in the terminal or save them to a file for later analysis, OPS has your back.
Because sometimes the system breaks… and you just whisper: Oh please, save-me.


✨ Features

  • Written in C
    • High performance with near-zero overhead
  • 🔍 Live View
    • Display logs for any systemd service directly in your terminal
  • 💾 Export Mode
    • Save logs to a local file using the -s flag
  • 🔐 Hardened Security
    • Strict validation: service names must be alphanumeric (including ., -, _)
    • Safe bounds: service names limited to 128 characters to prevent buffer overflows
  • 🧵 Robust Process Handling
    • Uses fork() and execvp() instead of unsafe system() calls
  • 🌍 Global Access
    • Installs to /usr/local/bin for system-wide availability

🚀 One-Liner Installation

Install OPS globally with a single command:

curl -fsSL https://raw.githubusercontent.com/49mg/ops/main/install.sh | bash

This will automatically clone, compile, and install the ops binary.


🧪 Usage

📟 View Logs in Terminal

ops nginx

Displays logs for the nginx systemd service.


💾 Save Logs to a File

ops nginx -s

Logs will be saved in your current directory as:

nginx.log

With permissions set to 0644.


🔐 Security Details

OPS implements multiple layers of protection:

  • Input Sanitization

    • Rejects any input containing /, \, or shell redirection characters
  • Privilege Separation

    • Uses fork() to isolate journalctl execution
  • Standard File Permissions

    • Owner: Read / Write
    • Group & Others: Read-only
  • No External Dependencies

    • Relies only on standard C libraries and systemd

🗂 Project Structure

ops/
├── main.c      # Argument parsing with getopt
├── utils.c     # Security validation & process logic
├── utils.h     # Function prototypes
├── Makefile    # Automated build system
├── install.sh  # Automated remote installer
└── README.md   # Documentation

🛠 Requirements

  • Linux system with:

    • systemd (journalctl)
    • gcc
    • make

📜 License

This project is licensed under the MIT License.


Built for sysadmins who’ve said “oh please…” one too many times. 😄

About

OPS (Oh Please, Save-me) — A secure C utility to quickly fetch, filter, and save systemd service logs. Because when things break, you need your logs fast

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors