diff --git a/ct/clawdbot.sh b/ct/clawdbot.sh index 09aca1f73..dadefee2f 100644 --- a/ct/clawdbot.sh +++ b/ct/clawdbot.sh @@ -24,39 +24,34 @@ function update_script() { check_container_storage check_container_resources - if [[ ! -d /opt/clawdbot ]]; then + if ! command -v clawdbot >/dev/null 2>&1; then msg_error "No ${APP} Installation Found!" exit fi - if check_for_gh_release "clawdbot" "clawdbot/clawdbot"; then - msg_info "Stopping Service" - systemctl stop clawdbot - msg_ok "Stopped Service" + msg_info "Stopping Service" + systemctl stop clawdbot + msg_ok "Stopped Service" - msg_info "Backing up Data" - cp -r /opt/clawdbot/data /opt/clawdbot_data_backup 2>/dev/null || true - cp -r /root/.clawdbot /root/.clawdbot_backup 2>/dev/null || true - msg_ok "Backed up Data" + msg_info "Backing up Data" + cp -r /opt/clawdbot/data /opt/clawdbot_data_backup 2>/dev/null || true + cp -r /root/.clawdbot /root/.clawdbot_backup 2>/dev/null || true + msg_ok "Backed up Data" - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "clawdbot" "clawdbot/clawdbot" + msg_info "Updating Clawdbot" + $STD npm install -g clawdbot@latest + msg_ok "Updated Clawdbot" - msg_info "Rebuilding Application" - cd /opt/clawdbot - $STD npm install - msg_ok "Rebuilt Application" + msg_info "Restoring Data" + cp -r /opt/clawdbot_data_backup/. /opt/clawdbot/data 2>/dev/null || true + cp -r /root/.clawdbot_backup/. /root/.clawdbot 2>/dev/null || true + rm -rf /opt/clawdbot_data_backup /root/.clawdbot_backup + msg_ok "Restored Data" - msg_info "Restoring Data" - cp -r /opt/clawdbot_data_backup/. /opt/clawdbot/data 2>/dev/null || true - cp -r /root/.clawdbot_backup/. /root/.clawdbot 2>/dev/null || true - rm -rf /opt/clawdbot_data_backup /root/.clawdbot_backup - msg_ok "Restored Data" - - msg_info "Starting Service" - systemctl start clawdbot - msg_ok "Started Service" - msg_ok "Updated successfully!" - fi + msg_info "Starting Service" + systemctl start clawdbot + msg_ok "Started Service" + msg_ok "Updated successfully!" exit } diff --git a/install/clawdbot-install.sh b/install/clawdbot-install.sh index 10dfb6126..861a8570f 100644 --- a/install/clawdbot-install.sh +++ b/install/clawdbot-install.sh @@ -19,16 +19,9 @@ $STD apt-get install -y \ git msg_ok "Installed Dependencies" -NODE_VERSION="24" setup_nodejs +NODE_VERSION="24" NODE_MODULE="clawdbot@latest" setup_nodejs import_local_ip -fetch_and_deploy_gh_release "clawdbot" "clawdbot/clawdbot" - -msg_info "Installing Clawdbot" -cd /opt/clawdbot -$STD npm install -msg_ok "Installed Clawdbot" - msg_info "Configuring Clawdbot" mkdir -p /opt/clawdbot/data cat </opt/clawdbot/.env @@ -49,7 +42,7 @@ Type=simple User=root WorkingDirectory=/opt/clawdbot EnvironmentFile=/opt/clawdbot/.env -ExecStart=/usr/bin/npm start +ExecStart=/usr/bin/clawdbot Restart=on-failure RestartSec=5