diff --git a/workflows/Send Email if server has upgradable packages-2925/readme-2925.md b/workflows/Send Email if server has upgradable packages-2925/readme-2925.md new file mode 100644 index 000000000..3a5cf7940 --- /dev/null +++ b/workflows/Send Email if server has upgradable packages-2925/readme-2925.md @@ -0,0 +1,240 @@ +Send Email if server has upgradable packages + +https://n8nworkflows.xyz/workflows/send-email-if-server-has-upgradable-packages-2925 + + +# Send Email if server has upgradable packages + +### 1. Workflow Overview + +This workflow automates the daily monitoring of upgradable packages on an Ubuntu server and sends an email notification if updates are available. It is designed for system administrators or DevOps engineers who want to maintain server security and performance by staying informed about package upgrades without manual intervention. + +The workflow is logically divided into the following blocks: + +- **1.1 Scheduled Trigger**: Initiates the workflow execution daily. +- **1.2 Package Upgrade Check via SSH**: Connects to the Ubuntu server over SSH and runs a command to list upgradable packages. +- **1.3 Data Formatting**: Converts the raw command output into a clean HTML list for email readability. +- **1.4 Conditional Check**: Determines if any packages are upgradable and decides whether to send an email. +- **1.5 Email Notification**: Sends an email alert with the list of upgradable packages if any are found. + +--- + +### 2. Block-by-Block Analysis + +#### 1.1 Scheduled Trigger + +- **Overview:** + This block triggers the workflow automatically once every day to perform the upgrade check without manual initiation. + +- **Nodes Involved:** + - Run workflow every day + +- **Node Details:** + - **Run workflow every day** + - Type: Schedule Trigger + - Configuration: Set to trigger at a daily interval (default time unspecified, runs once every 24 hours) + - Inputs: None (trigger node) + - Outputs: Connects to "List upgradable packages" node + - Edge Cases: Misconfiguration of schedule interval could cause no runs or multiple runs per day + - Version: 1.2 + - Notes: Ensures automation and timeliness of the update checks + +#### 1.2 Package Upgrade Check via SSH + +- **Overview:** + Connects securely to the Ubuntu server via SSH and executes the command `apt list --upgradable` to retrieve a list of packages that can be upgraded. + +- **Nodes Involved:** + - List upgradable packages + +- **Node Details:** + - **List upgradable packages** + - Type: SSH + - Configuration: Runs the shell command `apt list --upgradable` on the remote server + - Credentials: Uses SSH Password authentication (credential named "SSH Password account") + - Inputs: Triggered by schedule node + - Outputs: Raw command output passed to "Format as HTML list" node + - Edge Cases: + - SSH connection failures (wrong credentials, network issues) + - Command execution errors (e.g., server not Ubuntu, apt not installed) + - Empty output if no packages are upgradable + - Version: 1 + - Notes: Command output includes package names and versions in plain text + +#### 1.3 Data Formatting + +- **Overview:** + Transforms the raw text output from the SSH command into a structured HTML unordered list for better readability in the notification email. + +- **Nodes Involved:** + - Format as HTML list + +- **Node Details:** + - **Format as HTML list** + - Type: Code (JavaScript) + - Configuration: Custom JS code that: + - Splits the command output by new lines + - Filters out empty lines and the header line "Listing..." + - Wraps each package line in `
  • ` tags + - Wraps the entire list in `