March 30, 20251 yr Hi zusammen, ich würde gerne ein Script ausführen, sobald in einem Ordner neue Dateien erscheinen. Es soll über den Ordner selbst und entsprechende Unterordner wachen. Das Script ist folgendens: #!/bin/bash # Directory to monitor MONITOR_DIR="/path/to/your/directory" # Action to perform when a new .txt file appears handle_new_file() { NEW_FILE="$1" # Get the base filename without the path BASE_NAME=$(basename "$NEW_FILE") # Create the new filename with .original extension in the same directory NEW_FILENAME="${NEW_FILE}.original" # Write the base filename to the new file echo "$BASE_NAME" > "$NEW_FILENAME" # Log the action echo "New .txt file detected: $NEW_FILE, created $NEW_FILENAME" >> /path/to/your/logfile.log } # Start monitoring for new .mkv files recursively inotifywait -m -r -e create --format '%w%f' "$MONITOR_DIR" | while read NEWFILE do # Check if the new file is an .txt file if [[ "$NEWFILE" == *.txt ]]; then handle_new_file "$NEWFILE" fi done wie binde ich das jetzt unter unraid ein? Über User scripts würde es ja nicht passen, da ich dort ein schedule angeben muss, oder? Falls doch, welchen schedule muss ich da eintragen? Besten Gruß Edited March 31, 20251 yr by pille
March 30, 20251 yr 10 hours ago, pille said: welchen schedule muss ich da eintragen? on array start beispielsweise ...
March 31, 20251 yr Author 17 hours ago, alturismo said: on array start beispielsweise ... Ah perfekt. Und dann einfach ganz normal unter userscripts eintragen, also?
March 31, 20251 yr Solution 6 hours ago, pille said: Ah perfekt. Und dann einfach ganz normal unter userscripts eintragen, also? ja
April 14Apr 14 inotify finde ich nur als docker app in den CA (inotify-command). Geht das nur mit docker. Früher gab es wohl auch ein Plugin Nerdpack/Nerdtools? Nutzt du für dein Script die docker app?
April 14Apr 14 3 hours ago, PinkCarlos said:Nutzt du für dein Script die docker app?es sollte doch onboard sein ... gib mal im terminal inotifywait ein
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.