Additional Scripts For User.Scripts Plugin


Recommended Posts

#!/bin/bash

DIR="/mnt/user/media/movies/MOVIE_FOLDER/"

find "$DIR" -type f -name '*.mkv' | while read filepath; do
docker exec MKVToolNix /usr/bin/mkvmerge -J "$filepath"
done

 

I am trying to write script that use mkvtoolnix container to process my movie files

 

in line: docker exec MKVToolNix /usr/bin/mkvmerge -J "$filepath" i get error

Quote

"The file '/mnt/user/media/movies/MOVIE_FOLDER/MOVIE_FILE.mkv' could not be opened for reading: open file error.\n"

i don't know why script can't read this file

Link to comment

I read https://docs.unraid.net/legacy/FAQ/shrink-array/ and followed the link for step 8 "Run the clear an array drive script" that took me to 

 the comment that has a download link for the "clear_array_drive" script.

I tried running it but got an error.

```

Found a marked and empty drive to clear:  Disk 3  ( /mnt/disk3 )
+ echo -e '* Disk 3 will be unmounted first.'
* Disk 3 will be unmounted first.
+ echo '* Then zeroes will be written to the entire drive.'
* Then zeroes will be written to the entire drive.
+ echo '* Parity will be preserved throughout.'
* Parity will be preserved throughout.
+ echo '* Clearing while updating Parity takes a VERY long time!'
* Clearing while updating Parity takes a VERY long time!
+ echo '* The progress of the clearing will not be visible until it'\''s done!'
* The progress of the clearing will not be visible until it's done!
+ echo '* When complete, Disk 3 will be ready for removal from array.'
* When complete, Disk 3 will be ready for removal from array.
+ echo -e '* Commands to be executed:\n***** \x1b[36;01m umount /mnt/disk3 \x1b[39;49;00m\n***** \x1b[36;01m dd bs=1M if=/dev/zero of=/dev/md3  \x1b[39;49;00m\n'
* Commands to be executed:
*****  umount /mnt/disk3
*****  dd bs=1M if=/dev/zero of=/dev/md3

+ '[' clear_array_drive == /tmp/user.scripts/ ']'
+ echo -n 'Press ! to proceed. Any other key aborts, with no changes made. '
Press ! to proceed. Any other key aborts, with no changes made. + ch=
+ read -n 1 ch
!+ echo -e -n '\r                                                                  \r'
+ '[' '!' '!=' '!' ']'
+ logger -tclear_array_drive 'Clear an unRAID array data drive  v1.4'
+ echo -e '\rUnmounting Disk 3 ...'
Unmounting Disk 3 ...
+ logger -tclear_array_drive 'Unmounting Disk 3  (command: umount /mnt/disk3 ) ...'
+ umount /mnt/disk3
+ echo -e 'Clearing   Disk 3 ...'
Clearing   Disk 3 ...
+ logger -tclear_array_drive 'Clearing Disk 3  (command: dd bs=1M if=/dev/zero of=/dev/md3  ) ...'
+ dd bs=1M if=/dev/zero of=/dev/md3
dd: error writing '/dev/md3': No space left on device
9+0 records in
8+0 records out
8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.00256501 s, 3.3 GB/s
+ logger -tclear_array_drive 'Clearing Disk 3 is complete'
+ echo -e '\nA message saying "error writing ... no space left" is expected, NOT an error.\n'

A message saying "error writing ... no space left" is expected, NOT an error.

+ echo -e 'Unless errors appeared, the drive is now cleared!'
Unless errors appeared, the drive is now cleared!
+ echo -e 'Because the drive is now unmountable, the array should be stopped,'
Because the drive is now unmountable, the array should be stopped,
+ echo -e 'and the drive removed (or reformatted).'
and the drive removed (or reformatted).
+ exit

```

I ran the script with `sh -x` so there's debug output. I see it uses `/dev/mdX` not `/dev/mdXp1`. Is that the issue? Are people using this script? Do I have an old version of the script? Here's the download link for the script from the comment by RobJ https://s3-us-west-2.amazonaws.com/upload.forums.unraid.net/live/monthly_2016_09/clear_an_array_drive_zip.80cc67c667b13547f490de09b702bf4b

I also searched this topic for "of=/dev/md" and I didn't see any references that included the "p1".

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.