hekod19045 commited on
Commit
646cee8
1 Parent(s): 4b66f3b

Create dumper.sh

Browse files
Files changed (1) hide show
  1. dumper.sh +37 -0
dumper.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Variables
4
+ FILE_PATH="/etc/searxng/settings.yml" # Path to the file you want to monitor
5
+ NEKOBIN_API="https://nekobin.com/api/documents" # Nekobin API endpoint
6
+ CHECK_INTERVAL=10 # Time (in seconds) between checks
7
+
8
+ # Function to check if the file exists and upload its content to Nekobin
9
+ function upload_to_nekobin() {
10
+ while true; do
11
+ # Check if the file exists
12
+ if [ -f "$FILE_PATH" ]; then
13
+ echo "File found! Uploading to Nekobin..."
14
+
15
+ # Upload the content of the file to Nekobin and get the response
16
+ response=$(curl -s -X POST -d "{\"content\": \"$(cat "$FILE_PATH")\"}" -H "Content-Type: application/json" $NEKOBIN_API)
17
+
18
+ # Extract the key from the JSON response
19
+ key=$(echo "$response" | grep -o '"key":"[^"]*' | grep -o '[^"]*$')
20
+
21
+ # Construct the URL
22
+ url="https://nekobin.com/$key"
23
+
24
+ echo "File uploaded successfully. You can view it at: $url"
25
+
26
+ # Exit after successful upload
27
+ break
28
+ else
29
+ echo "File not found. Checking again in $CHECK_INTERVAL seconds..."
30
+ fi
31
+ # Wait before checking again
32
+ sleep $CHECK_INTERVAL
33
+ done
34
+ }
35
+
36
+ # Start monitoring for the file and upload once it exists
37
+ upload_to_nekobin