e8c0a73dbad117a3c06f5bbf51183c6ca5bccff6
set -euo pipefail across all four, but added deliberately rather than pasted in -- each script needed the places where a non-zero exit is normal handled first, or strict mode would have made them worse: - sys_monitor / process_monitor: `ps | head -n 6` is a latent SIGPIPE. head closes the pipe after six lines, and on a host with enough processes ps fills the buffer and exits 141, which pipefail turns into a script abort -- on exactly the busy machine you wanted to inspect. Confirmed the mechanism (a large producer into head returns 141) and those pipelines now tolerate it. - security_audit: find exits non-zero when it cannot read a directory, which is routine when walking the whole filesystem. Without handling, set -e aborted the audit part way while still looking complete. Also notes that a clean report as non-root means little, since find cannot descend where it may not read. - network_info: iptables needs root, so the last section aborted the script for ordinary users. Now reports the failure, and falls back to nft where iptables is absent. process_monitor also no longer kills on sight. `pkill -x` by name can match several processes at once, and as root that is an easy way to take down more than intended. It now prints what it matched and asks, with FORCE=1 for unattended use and a refusal rather than a hang when there is no tty. All four run clean; the kill path was tested against a live process and left it alive.
Linux System Administration Scripts
Automate routine tasks: This project provides a collection of Bash scripts to automate common Linux system administration duties. Automating daily sysadmin tasks improves efficiency and consistency by reducing manual repetition and the risk of human error. Each script is designed to be distribution-agnostic, using only standard base utilities (e.g. rsync, tar, awk, grep, netstat/ss, systemctl) available on most Linux systems. All scripts are released under the GNU GPL v3.0 license and include usage information in their headers.
Included Scripts
backup.sh– Backup Utility: Archive directories into compressed tarballs for backups.restore.sh– Restore Utility: Restore files from backup archives.disk_cleanup.sh– Disk Usage & Cleanup: Report disk usage and identify large files; optionally clean package caches and temporary files to free space.log_inspect.sh– Log Inspection: Search within log files or tail the latest system logs for troubleshooting.log_rotate.sh– Log Rotation: Compress and rotate old log files to prevent excessive disk usagenetwork_info.sh– Network & Firewall Info: Show network interface details, routing table, open listening ports, and basic firewall (iptables) rules.process_monitor.sh– Process Management: List top resource-consuming processes and allow termination of processes by name or PID.security_audit.sh– Security Audit: Scan for security issues like world-writable files, SUID/SGID executables, and open network ports.service_manager.sh– Service Management: Start, stop, restart, or check status of system services, and enable/disable services at boot.sys_monitor.sh– System Monitoring: Display system uptime, resource utilization (CPU, memory, disk), and top processes.update_system.sh– System Updates: Apply available package updates and patches (works with apt, yum/dnf, zypper, pacman).user_manage.sh– User and Group Management: Create or remove user accounts and groups, modify user group memberships, and lock/unlock accounts.zimbra_backup.sh- Create a backup for a zimbra mailbox.zimbra_restore.sh- Restore a backup for a zimbra mailbox.rsync_magic.sh- A smart Bash script that wraps rsync for safe, flexible, and efficient file synchronization and backups.
Languages
Shell
100%