Skip to main content

ak-cli

A small CLI I built for my own server management needs — quick answers to "what's using the RAM", "is this port open", "how full is the disk", without reaching for a full monitoring stack. Sharing it in case it's useful to someone else too.

Every command works both as a direct CLI call and from an interactive menu, so you can script it or just run ak and pick from a list.

Features

Command Description
system-info OS, architecture, Python version, hostname
disk-usage Usage for every mounted disk/partition
network-info IPv4 address of every network interface
memory-info RAM and swap usage
cpu-info Core count, current usage, frequency
process-list Top processes by memory usage
uptime System boot time and uptime
users Currently logged-in users
port-check Check whether a TCP port on a host is open
backup-init Create a backup config template
backup Archive configured folders and send to Telegram

Requirements

  • Python 3.11+

Installation

Clone the repo and install it in a virtual environment. uv is recommended:

git clone https://github.com/AmirKenzo/ak-cli.git
cd ak-cli
uv sync
uv run ak

Or with plain pip:

git clone https://github.com/AmirKenzo/ak-cli.git
cd ak-cli
python -m venv .venv
.venv/Scripts/activate   # on Linux/macOS: source .venv/bin/activate
pip install -e .
ak

Usage

Running ak with no arguments opens the interactive menu:

ak

Every command is also available directly, which is handy for scripts and one-liners:

ak system-info
ak disk-usage
ak memory-info
ak cpu-info
ak process-list --limit 5
ak port-check example.com 443
ak uptime
ak users

Backups

ak backup archives an explicit target — a known type or a folder path — into a .tar.gz and sends it to a Telegram chat via Telethon. A target is always required, so it never silently sends something you didn't ask for:

ak backup                    # error: target is required
ak backup pasarguard         # backs up /opt/pasarguard + /var/lib/pasarguard, nothing else
ak backup /etc/nginx         # backs up an arbitrary folder
ak backup pasarguard --keep  # also save the archive in the current directory

Known types live in BACKUP_TYPES in src/ak/backup.py (currently just pasarguard); anything else passed as the target is treated as a literal folder path.

ak backup-init   # interactive wizard: prompts for telegram creds, saves to ~/.config/ak/backup.json

If you skip backup-init and just run ak backup <target> in a terminal, it prompts you for the Telegram bot token/chat ID on the spot (and offers to save them) instead of failing. api_id/api_hash default to Telegram Desktop's public API credentials if left unset, so only bot_token and chat_id are needed. They can also be passed as flags for one-off/scripted runs:

ak backup pasarguard --bot-token "<token>" --chat-id -1001234567890

Config can also be provided entirely via environment variables — useful for cron/systemd, where there's no terminal to prompt on: AK_TG_API_ID, AK_TG_API_HASH, AK_TG_BOT_TOKEN, AK_TG_CHAT_ID, and AK_BACKUP_CONFIG to point at a non-default config file location.

The upload connects with a short per-attempt timeout and few retries so a blocked/unreachable network fails fast (within SEND_TIMEOUT_SECONDS, 900s) instead of hanging — if your server can't reach Telegram directly at all (common when self-hosting in regions that filter it), no client-side setting fixes that; you'd need a proxy in front of it.

Roadmap

  • Scheduled (cron) backup runs
  • Including database dumps alongside the folder backups

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

akctl-0.1.5.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

akctl-0.1.5-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file akctl-0.1.5.tar.gz.

File metadata

  • Download URL: akctl-0.1.5.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for akctl-0.1.5.tar.gz
Algorithm Hash digest
SHA256 4a73358fad1cfdf4834b1bbaeaa7185d047ec5d49b7710fed01b68bb62e674d3
MD5 63ec06224d19b38e41a2dde0f72e6dad
BLAKE2b-256 b6ab5e236294e426e4b3c48d55d0354028cd15f1f94e94bc8f1e867d00aa1ee6

See more details on using hashes here.

File details

Details for the file akctl-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: akctl-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for akctl-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 59ed40aea0c6e47e54b3197e4ca7fc143de177ab6d5c513e904dbd37c2577cfd
MD5 147947cfaf00ab62dd3d18d428798c94
BLAKE2b-256 8cb88bdbda336d64262ec8db4cdc1f6ab7ffbdc647391e6c708cdf0e5b70dcd0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page