A repo for scripts that uses master.sh to run scripts useful scripts on cloudpanel
Find a file
hhftechnologies 6219ce697b update
2024-11-27 21:17:10 +05:30
install update 2024-11-27 21:17:10 +05:30
maintenance update 2024-11-27 20:12:45 +05:30
monitoring Add monitoring/goaccess-setup.sh 2024-11-27 13:22:44 +05:30
optimize Update optimize/optimize-server.sh 2024-11-27 14:35:01 +05:30
security update 2024-11-27 20:25:11 +05:30
master-gitlab.sh update 2024-11-26 17:37:02 +05:30
master.sh Update master.sh 2024-11-25 22:16:44 +05:30
README.md Update README.md 2024-11-25 22:24:27 +05:30

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

  1. Fetch List of Scripts: The script automatically fetches the list of available CloudPanel management scripts from this repository.
  2. Select a Script: Choose from various categories like backups, security, maintenance, or site management.
  3. 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 scripts
  • curl: Used to fetch the list of scripts and download individual scripts
  • jq: 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:

  1. Fork the repository
  2. Create a new branch with your feature or bugfix
  3. Submit a pull request for review

Adding New Scripts

To add a new CloudPanel management script:

  1. Create your script in the appropriate category folder (e.g., backup/, security/, maintenance/)
  2. Ensure the script follows CloudPanel best practices and includes proper error handling
  3. Make the script executable (chmod +x script_name.sh)
  4. Add appropriate documentation and usage examples
  5. Submit a pull request

Script Categories

  • backup/: Backup and restore scripts
  • security/: Security-related scripts (SSL, firewall, etc.)
  • maintenance/: Server maintenance scripts
  • sites/: Website management scripts
  • database/: Database management scripts
  • monitoring/: 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.