install | ||
maintenance | ||
monitoring | ||
optimize | ||
security | ||
master-gitlab.sh | ||
master.sh | ||
README.md |
CloudPanel Script Management
This repository contains the master.sh
script, designed to simplify the execution of CloudPanel management and automation scripts. The master.sh
script automatically fetches a list of available scripts from the repository, allows you to select and run them, and handles dependencies and cleanup. This guide explains how to use the master.sh
script to manage your CloudPanel server efficiently.
The goal of this repo is to make it as simple as possible to run maintenance and automation scripts for CloudPanel servers directly from our GitHub repository.
Table of Contents
Demo
wget https://git.hhf.technology/hhf/script-management-cloudpanel/raw/branch/main/master.sh -O master.sh && bash master.sh
Select any CloudPanel management script, such as backup/mysql-backup.sh
or security/ssl-renewal.sh
Script Selection Example
[Your script selection screenshot here]
Usage
To use the master.sh
script on your CloudPanel server, run the following command:
wget https://git.hhf.technology/hhf/script-management-cloudpanel/raw/branch/main/master.sh -O master.sh && bash master.sh
Running with Verbose Output
For detailed execution logs, especially useful when troubleshooting CloudPanel-related scripts:
bash master.sh -v
Selecting and Running Scripts
- Fetch List of Scripts: The script automatically fetches the list of available CloudPanel management scripts from this repository.
- Select a Script: Choose from various categories like backups, security, maintenance, or site management.
- Run the Script: The selected script is downloaded, executed, and cleaned up after execution.
Features
- Automatic Dependency Installation: Ensures that required tools like sudo, curl, and jq are installed before proceeding.
- CloudPanel Compatibility Check: Verifies that scripts are running on a CloudPanel installation.
- Script Categories:
- Backup Management
- SSL Certificate Management
- Site Deployment
- Database Management
- Security Updates
- Performance Optimization
- Verbose Mode: Use the
-v
flag to enable detailed logging during script execution. - Error Handling: Built-in error handling ensures that scripts exit gracefully and provide informative error messages.
- Cleanup: Automatically removes temporary files and the script itself after execution.
Dependencies
The master.sh
script relies on the following tools:
sudo
: Ensures elevated permissions for installing packages and running scriptscurl
: Used to fetch the list of scripts and download individual scriptsjq
: Parses JSON responses from Forgejo API
If any of these tools are not installed, the script will attempt to install them automatically.
Error Handling
The script includes robust error handling mechanisms:
- Command Failures: Handles network issues, missing dependencies, and CloudPanel-specific errors
- Invalid Script Selection: Prompts for retry on invalid selections
- CloudPanel State Verification: Checks CloudPanel service status before executing critical scripts
- HTTP Status Codes: Provides feedback if script downloads fail
Cleanup
After running the selected script(s), the master.sh script performs the following cleanup actions:
- Temporary Files: Removes any temporary files created during script execution
- Log Rotation: Manages CloudPanel-related log files
- Self-Removal: Deletes the
master.sh
script itself - These actions ensure that your CloudPanel server remains clean after script execution
Contributing
We welcome contributions to enhance CloudPanel automation! To contribute:
- Fork the repository
- Create a new branch with your feature or bugfix
- Submit a pull request for review
Adding New Scripts
To add a new CloudPanel management script:
- Create your script in the appropriate category folder (e.g.,
backup/
,security/
,maintenance/
) - Ensure the script follows CloudPanel best practices and includes proper error handling
- Make the script executable (
chmod +x script_name.sh
) - Add appropriate documentation and usage examples
- Submit a pull request
Script Categories
backup/
: Backup and restore scriptssecurity/
: Security-related scripts (SSL, firewall, etc.)maintenance/
: Server maintenance scriptssites/
: Website management scriptsdatabase/
: Database management scriptsmonitoring/
: Server monitoring scripts
License
MIT License
Copyright (c) 2024 hhf technology
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.