A light, powerful, and robust sourceable/self-callable Bash library of utilities designed to simplify common server monitoring, analytics, security, and administrative tasks.
PSTool automates daily server routine operations and can be used either as an interactive command-line tool or running in the background as continuous monitoring daemons.
- Robust Parameter Parsing: Safely processes switches and extracts arguments without dangerous code evaluation (
eval). - Background Daemon Management: Built-in mechanisms to easily run script modules as background daemons (
nohupwrappers). - Comprehensive Logging: Native system logging (
syslog/logger) and standalone text file logging with timestamps.
Below is the complete list of available public actions provided by PSTool, along with descriptions extracted directly from each module's context help.
| Action / Command | Description |
|---|---|
apachehosts |
Print apache-hosted virtualhosts (host, IP, port, root, config) |
autherrors |
Get summary of authentication errors of <service> from [time from] to [time to] |
backuper |
Backup data using [sync|archive|delta|mysqldump] actions |
bwmon |
Monitor bandwidth of [interface] in [interval] and if over than <limit> send alert on <mailto> |
dellstatus |
Print DELL server system or chassis errors and send alert message |
dfalert |
Monitor disk-free status and send warnings |
diskident |
Visual disks identification (DELL's omereport is needed!) |
dosmonitor |
Monitor DOS attacks and block suspicious connections |
extfsmonitor |
Monitor linux ExtFS status and send warnings |
filesbytype |
Print number and total size of files in <directory> with optional find [params]. |
checkmount |
Check if <path> is mounted |
inival |
Parse INI [file] and get all sections |
irqstat |
Print IRQ statistics |
loadmonitor |
Check current load and send warning on overload. |
logarchive |
Logorotate onto external device |
loginmonitor |
Monitor unsuccessfull logins into services |
logins |
Show successfully logins on various protocols (optionally skip allowed users). |
logrotate_ext |
Logorotate onto external device |
logrotconf |
Print logrotate config of files in /var/log/* and optionally use output [format] |
logrotsetyear |
Change logrotate period of [file] to one year |
mail |
Send simple text e-mail (optionally with an attachment). |
markstd |
Mark STDOUT and STDERR with timestamp |
megaclimonitor |
Monitor megacli RAID status and send warnings |
memusage |
Show memory usage by processes (optionally print swap usage). |
monitorservice |
Monitor service |
mysqlquerymon |
Monitor MySQL with simple <query> using <params> executed for [max-time] (seconds) |
mysqlresmon |
Monitor MySQL query and log over <logtime>, kill over <killtime>, log over <logmem>, kill over <killmem> |
netmask |
Convert netmask to CIDR or reverse |
procmemusage |
Get process memory usage of [PID|/path/to/file.pid] optionally with type of [VmSize=default|VmRSS] |
procswapusage |
Get process swap usage |
rsync |
Rsync <source> into <target> with optional [params] |
selfupdate |
Run self-update of PSTool |
semafor |
Start and/or stop semafor on current script |
serverstatus |
Check if server is living and accessible. |
service |
Start (or stop or restart or get status about) PST service |
smarterror |
Get S.M.A.R.T errors for all disks |
spamcopcheck |
Check [IPs or hostnames] against bl.spamcop.net blacklist |
systemarchive |
Make rsync of root filesystem |
systembackup |
Make rsync of root filesystem |
-
Clone or Download the script: Place
pstoolinto your preferred binaries path (e.g.,/usr/local/bin/or/opt/pstool/).sudo wget https://raw.githubusercontent.com/p3t3r50n-cz/pstool/refs/heads/main/pstool.sh -O /usr/local/bin/pstool sudo chmod +x /usr/local/bin/pstool
-
Configuration Directories (Optional): Certain tools like
dosmonitororloginmonitorread optional flat-file configuration settings or write status caches into paths. You can create them using:sudo mkdir -p /etc/pstool sudo mkdir -p /var/log/pstool
PSTool can be executed directly as a standard binary command or sourced into your active environment.
pstool <action> [arguments...]To get usage parameters and example contexts for any command, simply invoke help:
# Complete actions reference
pstool help
# Action help & description
pstool loginmonitor help
pstool memusage helpYou can source the entire utility belt directly inside your custom shell scripts to inherit internal handlers:
#!/bin/bash
source /usr/local/bin/pstool
# Now you can leverage utility wrappers directly:
_pst_irqstat
_pst_checkmount "/path/to/dir"This project is open-source software licensed under GPLv3. Feel free to modify, extend, and share.