Guide for migrating from old script locations to new ones.
Scripts have been reorganized:
- Works on RHEL 8/9, Rocky, AlmaLinux, Ubuntu 20.04+, Debian 11+
- No hardcoded credentials
- Shared functions in
lib/common.sh - Multiple output formats (text/JSON/CSV)
- Environment variable configuration
Scripts organized by function, not OS:
server_management/CentOS/→server_management/orinstallation_scripts/server_management/Debian/→installation_scripts/miscellaneous/→utilities/orinstallation_scripts/
permissive_selinux.sh→selinux_troubleshoot.shnginx/newuser.sh→install_flask.sh
Scripts now use environment variables for configuration:
# Output
OUTPUT_FORMAT=json|csv|text
SAVE_TO_FILE=yes
OUTPUT_FILE=/path/file
# Installation
JENKINS_PORT=9090
ANSIBLE_VERSION=2.16
ENABLE_SSL=yes
# Backups
BACKUP_DIR=/mnt/backups
RETENTION_DAYS=30
ENCRYPT=yes
COMPRESSION=xz| Old Location | New Location | Notes |
|---|---|---|
server_management/CentOS/system_stats.sh |
server_management/system_stats.sh |
Multi-OS |
server_management/CentOS/change_hostname.sh |
server_management/change_hostname.sh |
Multi-OS |
server_management/CentOS/permissive_selinux.sh |
server_management/selinux_troubleshoot.sh |
Renamed |
server_management/CentOS/create_db.sh |
installation_scripts/create_db.sh |
Moved |
server_management/CentOS/sync_emails.sh |
installation_scripts/sync_emails.sh |
Moved |
server_management/CentOS/nginx/newuser.sh |
installation_scripts/install_flask.sh |
Replaced |
server_management/Debian/install_salt_minion.sh |
installation_scripts/install_salt_minion.sh |
Multi-OS |
miscellaneous/dirbackup.sh |
utilities/dirbackup.sh |
Enhanced |
miscellaneous/etcbackup.sh |
utilities/etcbackup.sh |
Wrapper |
miscellaneous/passgen.sh |
utilities/passgen.sh |
Enhanced |
miscellaneous/webpagedl.sh |
utilities/webpagedl.sh |
Enhanced |
miscellaneous/checkssh_conn.sh |
installation_scripts/checkssh_conn.sh |
Moved |
Old (CentOS only):
./server_management/CentOS/system_stats.shNew (Multi-OS with formats):
sudo ./server_management/system_stats.sh
sudo OUTPUT_FORMAT=json ./server_management/system_stats.sh
sudo OUTPUT_FORMAT=csv ./server_management/system_stats.shNew features: virtualization detection, container runtimes, security status, save to file.
Old:
./server_management/CentOS/change_hostname.sh webserver01New:
sudo ./server_management/change_hostname.sh webserver01
sudo RESTART_NETWORK=yes ./server_management/change_hostname.sh db-01New features: RFC 1123 validation, cloud platform detection (AWS/Azure/GCP), updates /etc/hosts.
Old (just disable):
./server_management/CentOS/permissive_selinux.shNew (troubleshoot first):
sudo ./server_management/selinux_troubleshoot.sh status
sudo ./server_management/selinux_troubleshoot.sh denials
sudo ./server_management/selinux_troubleshoot.sh suggest
sudo ./server_management/selinux_troubleshoot.sh permissive # Only if neededNew features: status, denials, suggest, permissive, enforcing commands. Includes audit2why integration.
Old:
./miscellaneous/dirbackup.sh /var/wwwNew:
sudo ./utilities/dirbackup.sh /var/www
sudo ENCRYPT=yes RETENTION_DAYS=30 ./utilities/dirbackup.sh /var/www
sudo INCREMENTAL=yes ./utilities/dirbackup.sh /dataNew features: gzip/bzip2/xz compression, GPG encryption, SHA256 verification, retention policy, incremental backups.
Old:
./miscellaneous/passgen.shNew:
./utilities/passgen.sh 10 32
PASSWORD_TYPE=special ./utilities/passgen.sh 10 32
PASSWORD_TYPE=passphrase ./utilities/passgen.sh 1 5
OUTPUT_FORMAT=csv ./utilities/passgen.sh 100 > passwords.csvNew features: 4 password types (alphanumeric/special/passphrase/PIN), strength assessment, JSON/CSV output.
Old:
./miscellaneous/webpagedl.sh https://example.comNew:
./utilities/webpagedl.sh https://example.com
RETRY_COUNT=5 ./utilities/webpagedl.sh https://example.com
MIRROR_MODE=yes ./utilities/webpagedl.sh https://example.comNew features: wget/curl/aria2 support, retry logic, mirror mode, authentication.
Old:
./server_management/CentOS/system_stats.sh > /var/log/stats.txtNew:
OUTPUT_FORMAT=json SAVE_TO_FILE=yes OUTPUT_FILE=/var/log/stats.json ./server_management/system_stats.shOld:
0 2 * * * /root/scripts/miscellaneous/etcbackup.sh
New:
0 2 * * * BACKUP_DIR=/mnt/backups ENCRYPT=yes /root/scripts/utilities/etcbackup.sh
Old:
./miscellaneous/passgen.shNew:
PASSWORD_TYPE=special ./utilities/passgen.sh 1 32
OUTPUT_FORMAT=csv ./utilities/passgen.sh 100 16 > passwords.csvOld:
./server_management/CentOS/change_hostname.sh webserver01New (same syntax, works on Ubuntu/Debian too):
sudo ./server_management/change_hostname.sh webserver01Old (just disable):
./server_management/CentOS/permissive_selinux.shNew (troubleshoot):
sudo ./server_management/selinux_troubleshoot.sh status
sudo ./server_management/selinux_troubleshoot.sh denials
sudo ./server_management/selinux_troubleshoot.sh suggest
# Fix the policy instead of disablingLOG_LEVEL=debug|info|warning|error
QUIET_MODE=yes
OUTPUT_FORMAT=json|csv|text
SAVE_TO_FILE=yes
OUTPUT_FILE=/path/fileSKIP_FIREWALL=yes
SKIP_SELINUX=yes
ANSIBLE_VERSION=2.16
INSTALL_METHOD=pip|package
JENKINS_PORT=9090
JENKINS_VERSION=lts|weekly
APP_TYPE=static|proxy|flask
ENABLE_SSL=yes
DOMAIN_NAME=example.com
PYTHON_VERSION=3.12.7
SALT_VERSION=3006
MINION_ID=server01BACKUP_DIR=/mnt/backups
RETENTION_DAYS=30
INCREMENTAL=yes
COMPRESSION=gzip|bzip2|xz
VERIFY=yes
ENCRYPT=yes
GPG_RECIPIENT=user@example.comPASSWORD_TYPE=alphanumeric|special|passphrase|pin
AVOID_AMBIGUOUS=yes
CLIPBOARD=yes
DOWNLOAD_METHOD=wget|curl|aria2
RETRY_COUNT=5
MIRROR_MODE=yes
AUTH_USER=username
AUTH_PASS=password# Update paths
sed -i 's|miscellaneous/etcbackup.sh|utilities/etcbackup.sh|g' /etc/crontab
sed -i 's|server_management/CentOS/|server_management/|g' /etc/crontabFind and update:
grep -r "miscellaneous/" /opt/scripts/
grep -r "server_management/CentOS/" /opt/scripts/# Old
- command: /opt/scripts/miscellaneous/dirbackup.sh /data
# New
- command: /opt/scripts/utilities/dirbackup.sh /data
environment:
BACKUP_DIR: /mnt/backups
ENCRYPT: yesTest in non-production first:
# Clone to test
git clone https://github.com/user/sysadmin-shell-scripts.git /tmp/test-scripts
# Test with your params
cd /tmp/test-scripts
sudo OUTPUT_FORMAT=json ./server_management/system_stats.shVerify syntax:
find . -name "*.sh" -exec bash -n {} \;
find python-scripts -name "*.py" -exec python3 -m py_compile {} \;- Now: Old scripts deprecated, new scripts available
- Future: Old OS-specific directories may be removed
- Action: Migrate to new scripts ASAP
- List all scripts used in automation
- Update cron jobs
- Update systemd timers
- Update Ansible/Salt playbooks
- Update documentation
- Test in non-production
- Update production
- Script help:
./script.sh --help - See README.md for full documentation
- Report issues: https://github.com/user/sysadmin-shell-scripts/issues