Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Useful scripts

Featured Replies

Anyone have useful scripts that they care to share with everyone?

 

I've got this script that runs in /etc/cron.daily and does a few maintenance tasks...

 

# Fixes group/user permissions on all user shares

chmod -R 777 /mnt/user/*

chown -R nobody.users /mnt/user/*

 

#Creates folders for all files in a directory and the moves them into the folder

cd /mnt/user/media/movies

find . -type f -maxdepth 1 -exec sh -c 'mkdir "${1%.*}" ; mv "$1" "${1%.*}" ' _ {} \;

cd /mnt/user/media/documentaries

find . -type f -maxdepth 1 -exec sh -c 'mkdir "${1%.*}" ; mv "$1" "${1%.*}" ' _ {} \;

 

#Find duplicate files

fdupes -r /mnt/user/* > /boot/config/scripts/dupes.txt

 

First:  What version of unRAID are your running?

 

# Fixes group/user permissions on all user shares

chmod -R 777 /mnt/user/*

chown -R nobody.users /mnt/user/*

Why on gods green earth are you doing this?  That is essentially like running the newperms script daily... which is not needed.

 

#Creates folders for all files in a directory and the moves them into the folder

cd /mnt/user/media/movies

find . -type f -maxdepth 1 -exec sh -c 'mkdir "${1%.*}" ; mv "$1" "${1%.*}" ' _ {} \;

cd /mnt/user/media/documentaries

find . -type f -maxdepth 1 -exec sh -c 'mkdir "${1%.*}" ; mv "$1" "${1%.*}" ' _ {} \;

nifty but only useful if you want everything in folders.  I am going to guess it has something to do with the way you scrap media.

 

#Find duplicate files

fdupes -r /mnt/user/* > /boot/config/scripts/dupes.txt

I rarely have dupes on my machine... and I would not put that on the flash drive.  Save it to an array disk so as not to wear out the flash drive any faster than needed.

  • Author

First:  What version of unRAID are your running?

I've tested on UNRAID 5 and 6 but I don't see why any of the scripts mentioned wouldn't work on any recent version of UNRAID, do you?

Why on gods green earth are you doing this?  That is essentially like running the newperms script daily... which is not needed.

Another work in progress script that moves files to their correct locations from a few USB drives. This script runs as root for the time being thus the need to modify permissions so frequently. Considering UNRAID is just a play box, this doesnt really do much damage.

nifty but only useful if you want everything in folders.  I am going to guess it has something to do with the way you scrap media.

Correct.

I rarely have dupes on my machine... and I would not put that on the flash drive.  Save it to an array disk so as not to wear out the flash drive any faster than needed.

Great! However I imagine others could potentially have duplicates depending on how files are added to their UNRAID servers. I highly doubt a few extra writes a night is going to cause a flash drive to fail prematurely.

Heres mine

 

 

Sync Seedbox

#!/bin/bash
login=xxxxxxx
pass=xxxxxx
host=xxxxxx
remote_dir=/torrents/hardlinked
local_dir=/mnt/user/Data/Misc/Downloading/Downloaded

trap "rm -f /tmp/synctorrent.lock" SIGINT SIGTERM
if [ -e /tmp/synctorrent.lock ]
then
  echo "Synctorrent is running already."
  exit 1
else
  touch /tmp/synctorrent.lock
  

lftp  << EOF
set ftp:ssl-protect-data yes
set ftp:ssl-protect-list yes
set mirror:use-pget-n 2
lftp -u $login,$pass $host
mirror -c -P5 --Remove-source-files $remote_dir $local_dir 
quit
EOF
  rm -f /tmp/synctorrent.lock
  chown -hR nobody /mnt/user/Data/Misc/Downloading/Downloaded/*
  chmod -R 777 /mnt/user/Data/Misc/Downloading/Downloaded/*
  /boot/extra/Scripts/unrarall -s --clean=all /mnt/user/Data/Misc/Downloading/Downloaded/
  exit 0
fi

 

 

sort.sh

#!/bin/bash
chown -hR nobody /mnt/user/Data/Misc/Downloading/Downloaded/*
chmod -R 777 /mnt/user/Data/Misc/Downloading/Downloaded/*
/boot/config/plugins/Scripts/unrarall -s --clean=all /mnt/user/Data/Misc/Downloading/Downloaded/

 

 

tgui.sh

#!/bin/bash
nospamphone=0
while :
do

pnumber=$"1111111111"
time=$(date +"%m-%d-%y %I:%M")

hdspacetot=$(df -h /mnt/user/ ~ | awk 'NR==2 {print $2}')
hdspacefree=$(df -h /mnt/user/ ~ | awk 'NR==2 {print $4}')
uptime=$((w ~ | awk 'NR==1 {print $3}') | cut -d "," -f 1)

exec 6<>/dev/tcp/192.168.2.4/80 && ur='\e[42;30mUP\e[0m' || ur='\e[41;30mDN\e[0m' 
exec 6<>/dev/tcp/192.168.2.11/8080 && ut='\e[42;30mUP\e[0m' || ut='\e[41;30mDN\e[0m'
exec 6<>/dev/tcp/192.168.2.11/8081 && sb='\e[42;30mUP\e[0m' || sb='\e[41;30mDN\e[0m'
exec 6<>/dev/tcp/192.168.2.11/8082 && ch='\e[42;30mUP\e[0m' || ch='\e[41;30mDN\e[0m'
exec 6<>/dev/tcp/192.168.2.12/32400 && px='\e[42;30mUP\e[0m' || px='\e[41;30mDN\e[0m'
exec 6<>/dev/tcp/192.168.2.14/64738 && mb='\e[42;30mUP\e[0m' || mb='\e[41;30mDN\e[0m'
exec 6<>/dev/tcp/192.168.2.14/25565 && mc='\e[42;30mUP\e[0m' || mc='\e[41;30mDN\e[0m' 
# mc='\e[41;30mOF\e[0m'
exec 6<>/dev/tcp/192.168.2.13/80 && ws='\e[42;30mUP\e[0m' || ws='\e[41;30mDN\e[0m' 

cleanur=$(echo $ur | sed 's/^.........\(.*\).....$/\1/')
cleanut=$(echo $ut | sed 's/^.........\(.*\).....$/\1/')
cleansb=$(echo $sb | sed 's/^.........\(.*\).....$/\1/')
cleanch=$(echo $ch | sed 's/^.........\(.*\).....$/\1/')
cleanpx=$(echo $px | sed 's/^.........\(.*\).....$/\1/')
cleanmb=$(echo $mb | sed 's/^.........\(.*\).....$/\1/')
cleanmc=$(echo $mc | sed 's/^.........\(.*\).....$/\1/')
cleanws=$(echo $ws | sed 's/^.........\(.*\).....$/\1/')

if [ $ur = "\e[41;30mDN\e[0m" ] || [ $ut = "\e[41;30mDN\e[0m" ] || [ $sb = "\e[41;30mDN\e[0m" ] || [ $ch = "\e[41;30mDN\e[0m" ] || [ $px = "\e[41;30mDN\e[0m" ] || [ $mb = "\e[41;30mDN\e[0m" ] || [ $mc = "\e[41;30mDN\e[0m" ] || [ $ws = "\e[41;30mDN\e[0m" ] && [ $nospamphone -lt "1" ]; then
     nospamphone=$(($nospamphone + 1)) && curl "http://textbelt.com/text" -d number=$pnumber -d "message=Server Status Update \             unRAID=$cleanur ~~ uTorrent=$cleanut  SickBeard=$cleansb ~~ CouchPotato=$cleanch  Plex=$cleanpx ~~ Mumble=$cleanmb  MineCraft=$cleanmc ~~ WebServer=$cleanws"
 echo "i sent one"
sleep 5
fi

if [ $ur = "\e[42;30mUP\e[0m" ] && [ $ut = "\e[42;30mUP\e[0m" ] && [ $sb = "\e[42;30mUP\e[0m" ] && [ $ch = "\e[42;30mUP\e[0m" ] && [ $px = "\e[42;30mUP\e[0m" ] && [ $mb = "\e[42;30mUP\e[0m" ] && [ $mc = "\e[42;30mUP\e[0m" ] && [ $ws = "\e[42;30mUP\e[0m" ] && [ $nospamphone -gt "0" ]; then 
     nospamphone=0 && curl "http://textbelt.com/text" -d number=$pnumber -d "message=Server Status Update \             Back Online and Operational"
fi

clear
echo -e "+==============================================================================+"
echo -e "=                                                                              ="
echo -e "=           \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;31m=====\e[0m    \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;31m====\e[0m     \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;31m====\e[0m     \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;31m====\e[0m     \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;31m===\e[0m             ="
echo -e "=           \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m         \e[1;34m:\e[0m\e[1;37m:\e[1;34m:\e[0m  \e[1;37m===\e[0m    \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m  \e[1;37m===\e[0m    \e[1;34m:\e[0m\e[1;37m:\e[0m\e[1;34m:\e[0m  \e[1;37m===\e[0m    \e[1;37m:\e[0m\e[1;34m:\e[0m\e[1;37m:\e[0m                ="
echo -e "=           \e[1;31m===         ===  ===    =======     =======      =====\e[0m             ="
echo -e "=           \e[1;37m===         ===  ===    === ===     ===             ===\e[0m            ="
echo -e "=            \e[1;31m=======\e[0m  \e[1;32m=\e[0m  \e[1;31m======\e[0m  \e[1;32m=\e[0m  \e[1;31m===  ===\e[0m \e[1;32m=\e[0m  \e[1;31m===\e[0m      \e[1;32m=\e[0m   \e[1;31m======\e[0m            ="
echo -e "=                                                                              ="
echo -e "=                Combined Operations in Rack Portable Storage                  ="
echo -e "=                                                                              ="
echo -e "=               VM Resource Pool                     Application Status        ="
echo -e "=       *------------------------------*           *-------------------*       ="
echo -e "=       | unRaid     vCPU 1 / 1810 MEM |           | unRAID:       $ur  |       ="
echo -e "=       | Windows8_R vCPU 7 / 2045 MEM |           | Plex:         $px  |       ="
echo -e "=       | Windows8_G vCPU 3 / 3072 MEM |           | SickBeard:    $sb  |       ="
echo -e "=       | Tkey       vCPU 1 /  768 MEM |           | CouchPotato:  $ch  |       ="
echo -e "=       *------------------------------*           | uTorrent:     $ut  |       ="
echo -e "=                  Raid Space                      | Mumble        $mb  |       ="
echo -e "=       *------------------------------*           | MC Server     $mc  |       ="
echo -e "=       |   $hdspacefree Free   /   $hdspacetot Total  |           | WebServer     $ws  |       ="
echo -e "=       *------------------------------*           *-------------------*       ="
echo -e "=                                                               $time ="
echo -e "=   IP 192.168.2.4 / 255.255.255.0 / 192.168.2.1              uptime: $uptime Day(s) ="
echo -e "+==============================================================================+"
sleep 60
done

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.