From b65090b315e426e23f19a3047a0f206750b7778d Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 17 Feb 2026 09:41:43 +0100 Subject: [PATCH] Add CronMaster addon; remove legacy installers Replace legacy container/install scripts with a single tools/addon/cronmaster.sh addon. The new script consolidates install, update and uninstall flows, uses community-scripts core functions, fetches prebuilt GitHub releases, sets up Node.js (defaults to v22), creates a systemd service and an update helper (/usr/local/bin/update_cronmaster). Removed ct/cronmaster.sh and install/cronmaster-install.sh to avoid duplication and centralize maintenance. --- ct/cronmaster.sh | 45 ------ frontend/public/json/cronmaster.json | 35 +++++ install/cronmaster-install.sh | 75 --------- tools/addon/cronmaster.sh | 226 +++++++++++++++++++++++++++ 4 files changed, 261 insertions(+), 120 deletions(-) delete mode 100644 ct/cronmaster.sh create mode 100644 frontend/public/json/cronmaster.json delete mode 100644 install/cronmaster-install.sh create mode 100644 tools/addon/cronmaster.sh diff --git a/ct/cronmaster.sh b/ct/cronmaster.sh deleted file mode 100644 index 7a2e0ac50..000000000 --- a/ct/cronmaster.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) -# Copyright (c) 2021-2026 community-scripts ORG -# Author: MickLesk (CanbiZ) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: - -APP="CRONMASTER" -var_tags="${var_tags:-}" -var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-4096}" -var_disk="${var_disk:-8}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" -var_unprivileged="${var_unprivileged:-1}" -#var_fuse="${var_fuse:-no}" -#var_tun="${var_tun:-no}" - -header_info "$APP" -variables -color -catch_errors - -function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -d /opt/cronmaster ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_info "Updating Debian LXC" - $STD apt update - $STD apt upgrade -y - msg_ok "Updated Debian LXC" - cleanup_lxc - exit -} - -start -build_container -description - -msg_ok "Completed successfully!" -msg_custom "🚀" "${GN}" "${APP} setup has been successfully initialized!" diff --git a/frontend/public/json/cronmaster.json b/frontend/public/json/cronmaster.json new file mode 100644 index 000000000..956ea3726 --- /dev/null +++ b/frontend/public/json/cronmaster.json @@ -0,0 +1,35 @@ +{ + "name": "CronMaster", + "slug": "cronmaster", + "categories": [ + 1 + ], + "date_created": "2026-02-17", + "type": "pve", + "updateable": true, + "privileged": false, + "interface_port": 3000, + "documentation": "https://github.com/fccview/cronmaster", + "website": "https://github.com/fccview/cronmaster", + "logo": "https://raw.githubusercontent.com/fccview/cronmaster/main/public/logo.png", + "config_path": "/opt/cronmaster/.env", + "description": "Self-hosted cron job scheduler with web UI, live logs, auth and prebuilt binaries provided upstream.", + "install_methods": [ + { + "type": "default", + "script": "tools/addon/cronmaster.sh", + "resources": { + "cpu": null, + "ram": null, + "hdd": null, + "os": null, + "version": null + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} \ No newline at end of file diff --git a/install/cronmaster-install.sh b/install/cronmaster-install.sh deleted file mode 100644 index 16b10816a..000000000 --- a/install/cronmaster-install.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2026 community-scripts ORG -# Author: Slaviša Arežina (tremor021) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://github.com/fccview/cronmaster - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os -setup_hwaccel - -msg_info "Installing dependencies" -$STD apt install -y pciutils -msg_ok "Installed dependencies" - -NODE_VERSION="24" NODE_MODULE="yarn" setup_nodejs - -setup_deb822_repo \ - "docker" \ - "https://download.docker.com/linux/debian/gpg" \ - "https://download.docker.com/linux/debian" \ - "trixie" \ - "stable" -$STD apt install -y docker-ce-cli -fetch_and_deploy_gh_release "cronmaster" "fccview/cronmaster" "tarball" - -msg_info "Setting up CronMaster" -AUTH_PASS="$(openssl rand -base64 18 | cut -c1-13)" -cd /opt/cronmaster -$STD yarn --frozen-lockfile -export NEXT_TELEMETRY_DISABLED=1 -$STD yarn build -cat </opt/cronmaster/.env -NODE_ENV=production -APP_URL= -LOCALE= -HOME= -AUTH_PASSWORD=${AUTH_PASS} -PORT=3000 -HOSTNAME="0.0.0.0" -NEXT_TELEMETRY_DISABLED=1 -EOF -{ - echo "CronMaster Credentials:" - echo "" - echo "Password: $AUTH_PASS" -}>>~/cronmaster.creds -msg_ok "Setup CronMaster" - -msg_info "Creating Service" -cat </etc/systemd/system/cronmaster.service -[Unit] -Description=CronMaster Service -After=network.target - -[Service] -EnvironmentFile=/opt/cronmaster/.env -WorkingDirectory=/opt/cronmaster -ExecStart=/usr/bin/yarn start -Restart=always - -[Install] -WantedBy=multi-user.target -EOF -systemctl start --now -q cronmaster -msg_info "Created Service" - -motd_ssh -customize -cleanup_lxc diff --git a/tools/addon/cronmaster.sh b/tools/addon/cronmaster.sh new file mode 100644 index 000000000..faf2780be --- /dev/null +++ b/tools/addon/cronmaster.sh @@ -0,0 +1,226 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/fccview/cronmaster + +if ! command -v curl &>/dev/null; then + printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2 + apt-get update >/dev/null 2>&1 + apt-get install -y curl >/dev/null 2>&1 +fi +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/tools.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/error_handler.func) + +# Enable error handling +set -Eeuo pipefail +trap 'error_handler' ERR + +# ============================================================================== +# CONFIGURATION +# ============================================================================== +APP="CronMaster" +APP_TYPE="addon" +INSTALL_PATH="/opt/cronmaster" +CONFIG_PATH="/opt/cronmaster/.env" +DEFAULT_PORT=3000 + +# Initialize all core functions (colors, formatting, icons, STD mode) +load_functions + +# ============================================================================== +# HEADER +# ============================================================================== +function header_info { + clear + cat <<"EOF" + ______ __ ___ __ + / ____/________ ____ / |/ /___ ______/ /____ _____ + / / / ___/ __ \/ __ \/ /|_/ / __ `/ ___/ __/ _ \/ ___/ +/ /___/ / / /_/ / / / / / / / /_/ (__ ) /_/ __/ / +\____/_/ \____/_/ /_/_/ /_/\__,_/____/\__/\___/_/ + +EOF +} + +# ============================================================================== +# OS DETECTION +# ============================================================================== +if [[ -f "/etc/alpine-release" ]]; then + msg_error "Alpine is not supported for ${APP}. Use Debian/Ubuntu." + exit 1 +elif [[ -f "/etc/debian_version" ]]; then + OS="Debian" + SERVICE_PATH="/etc/systemd/system/cronmaster.service" +else + echo -e "${CROSS} Unsupported OS detected. Exiting." + exit 1 +fi + +# ============================================================================== +# UNINSTALL +# ============================================================================== +function uninstall() { + msg_info "Uninstalling ${APP}" + systemctl disable --now cronmaster.service &>/dev/null || true + rm -f "$SERVICE_PATH" + rm -rf "$INSTALL_PATH" + rm -f "/usr/local/bin/update_cronmaster" + rm -f "$HOME/.cronmaster" + msg_ok "${APP} has been uninstalled" +} + +# ============================================================================== +# UPDATE +# ============================================================================== +function update() { + if check_for_gh_release "cronmaster" "fccview/cronmaster"; then + msg_info "Stopping service" + systemctl stop cronmaster.service &>/dev/null || true + msg_ok "Stopped service" + + msg_info "Backing up configuration" + cp "$CONFIG_PATH" /tmp/cronmaster.env.bak 2>/dev/null || true + msg_ok "Backed up configuration" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "cronmaster" "fccview/cronmaster" "prebuild" "latest" "$INSTALL_PATH" "cronmaster_*_prebuild.tar.gz" + + msg_info "Restoring configuration" + cp /tmp/cronmaster.env.bak "$CONFIG_PATH" 2>/dev/null || true + rm -f /tmp/cronmaster.env.bak + msg_ok "Restored configuration" + + msg_info "Starting service" + systemctl start cronmaster + msg_ok "Started service" + msg_ok "Updated successfully" + exit + fi +} + +# ============================================================================== +# INSTALL +# ============================================================================== +function install() { + # Setup Node.js (only installs if not present or different version) + if command -v node &>/dev/null; then + msg_ok "Node.js already installed ($(node -v))" + else + NODE_VERSION="22" setup_nodejs + fi + + # Force fresh download by removing version cache + rm -f "$HOME/.cronmaster" + fetch_and_deploy_gh_release "cronmaster" "fccview/cronmaster" "prebuild" "latest" "$INSTALL_PATH" "cronmaster_*_prebuild.tar.gz" + + local AUTH_PASS + AUTH_PASS="$(openssl rand -base64 18 | cut -c1-13)" + + msg_info "Creating configuration" + cat <"$CONFIG_PATH" +NODE_ENV=production +AUTH_PASSWORD=${AUTH_PASS} +PORT=${DEFAULT_PORT} +HOSTNAME=0.0.0.0 +NEXT_TELEMETRY_DISABLED=1 +EOF + chmod 600 "$CONFIG_PATH" + msg_ok "Created configuration" + + msg_info "Creating service" + cat <"$SERVICE_PATH" +[Unit] +Description=CronMaster Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=${INSTALL_PATH} +EnvironmentFile=${CONFIG_PATH} +ExecStart=/usr/bin/node ${INSTALL_PATH}/server.js +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-target.target +EOF + systemctl enable --now cronmaster &>/dev/null + msg_ok "Created and started service" + + # Create update script + msg_info "Creating update script" + cat <<'UPDATEEOF' >/usr/local/bin/update_cronmaster +#!/usr/bin/env bash +# CronMaster Update Script +type=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/tools/addon/cronmaster.sh)" +UPDATEEOF + chmod +x /usr/local/bin/update_cronmaster + msg_ok "Created update script (/usr/local/bin/update_cronmaster)" + + echo "" + msg_ok "${APP} is reachable at: ${BL}http://${LOCAL_IP}:${DEFAULT_PORT}${CL}" + msg_ok "Password: ${BL}${AUTH_PASS}${CL}" + echo "" +} + +# ============================================================================== +# MAIN +# ============================================================================== + +# Handle type=update (called from update script) +if [[ "${type:-}" == "update" ]]; then + header_info + if [[ -d "$INSTALL_PATH" ]]; then + update + else + msg_error "${APP} is not installed. Nothing to update." + exit 1 + fi + exit 0 +fi + +header_info +get_lxc_ip + +# Check if already installed +if [[ -d "$INSTALL_PATH" && -n "$(ls -A "$INSTALL_PATH" 2>/dev/null)" ]]; then + msg_warn "${APP} is already installed." + echo "" + + echo -n "${TAB}Uninstall ${APP}? (y/N): " + read -r uninstall_prompt + if [[ "${uninstall_prompt,,}" =~ ^(y|yes)$ ]]; then + uninstall + exit 0 + fi + + echo -n "${TAB}Update ${APP}? (y/N): " + read -r update_prompt + if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then + update + exit 0 + fi + + msg_warn "No action selected. Exiting." + exit 0 +fi + +# Fresh installation +msg_warn "${APP} is not installed." +echo "" +echo -e "${TAB}${INFO} This will install:" +echo -e "${TAB} - Node.js 22" +echo -e "${TAB} - CronMaster (prebuild)" +echo "" + +echo -n "${TAB}Install ${APP}? (y/N): " +read -r install_prompt +if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then + install +else + msg_warn "Installation cancelled. Exiting." + exit 0 +fi