From 2b112ae2e4f71506f9f15221248bd982015536bc Mon Sep 17 00:00:00 2001 From: Olivier <16240457+TiTidom-RC@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:50:15 +0200 Subject: [PATCH 1/2] Update commands.json --- data/commands/commands.json | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/data/commands/commands.json b/data/commands/commands.json index 4118a0e..3a76c0d 100644 --- a/data/commands/commands.json +++ b/data/commands/commands.json @@ -8,16 +8,16 @@ "subtype": "string" }, "nb_sys_updates": { - "name": "Sys Updates Number", + "name": "Nb Sys Updates", "short_description": "Number of System Updates", "description": "Retourne le nombre de mises à jour en attente sur le système distant", - "command": "sudo apt-get update -qq 2>/dev/null | cut -d'.' -f1", + "command": "sudo apt update -qq 2>/dev/null | grep -o '^[0-9]*' | awk 'BEGIN {ORS=\"\";} {print ($1 == \"\" ? 0 : $1)} END {if (NR == 0) print 0}'", "type": "info", - "subtype": "string" + "subtype": "numeric" }, "list_sys_updates": { - "name": "List System Updates", + "name": "List Sys Updates", "short_description": "List Packages to update", "description": "Retourne la liste des paquets systèmes en attente de mise à jour sur le système distant", "command": "sudo apt-get -qq update 2>/dev/null && sudo apt list --upgradable -qq 2>/dev/null | cut -d'/' -f1 | awk 'BEGIN {RS=\"\"}{gsub(/\\n/,\",\",$0); print $0}'", @@ -39,5 +39,13 @@ "command": "sudo apt-get -qq update 2>/dev/null && sudo apt-get -qq upgrade -y", "type": "action", "subtype": "other" - } + }, + "uptime": { + "name": "Uptime", + "short_description": "Uptime of the system", + "description": "Affiche l'uptime du système distant", + "command": "awk '{print $1}' /proc/uptime", + "type": "info", + "subtype": "numeric" + }, } From f15b3df69cf07cd7491c22ad460eac6ee4e6617a Mon Sep 17 00:00:00 2001 From: Olivier <16240457+TiTidom-RC@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:50:50 +0200 Subject: [PATCH 2/2] Update commands.json --- data/commands/commands.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/data/commands/commands.json b/data/commands/commands.json index 3a76c0d..4f7ba84 100644 --- a/data/commands/commands.json +++ b/data/commands/commands.json @@ -1,4 +1,12 @@ { + "uptime": { + "name": "Uptime", + "short_description": "Uptime of the system", + "description": "Affiche l'uptime du système distant", + "command": "awk '{print $1}' /proc/uptime", + "type": "info", + "subtype": "numeric" + }, "list_services": { "name": "List Running Services", "short_description": "List Running Services", @@ -39,13 +47,5 @@ "command": "sudo apt-get -qq update 2>/dev/null && sudo apt-get -qq upgrade -y", "type": "action", "subtype": "other" - }, - "uptime": { - "name": "Uptime", - "short_description": "Uptime of the system", - "description": "Affiche l'uptime du système distant", - "command": "awk '{print $1}' /proc/uptime", - "type": "info", - "subtype": "numeric" - }, + } }