wgstarks Posted December 26, 2022 Share Posted December 26, 2022 3 hours ago, glave said: Unfortunately they don't work in some situations, although I haven't tracked down the specifics yet. I have a 50GB minimum set on each share, yet I still have a few disks than continue to fill up past that without triggering warnings. Disk utilization warnings are set in disk settings not share settings. From your post, if the share continues to fill with less than 50GB available you may have the split level set wrong. Quote Link to comment
trurl Posted December 26, 2022 Share Posted December 26, 2022 4 hours ago, glave said: they don't work in some situations Notifications for disk utilization won't do anything to keep you from filling a disk, it is just a notification. You need to fix whatever. Maybe start a new thread with your diagnostics. Quote Link to comment
CptRetro Posted January 7, 2023 Share Posted January 7, 2023 Hey, is there also a script to backup the cache drive? Quote Link to comment
Netix Posted February 15, 2023 Share Posted February 15, 2023 So I'm running the updated Shrink array that was posted in the last pages. I shrinked one 6TB drive that had error and it went well. Now, I'm trying to Shrink away another 8TB drive but I'm getting some really slow speed.. ~4 MB/s.. For the 6TB it was way faster then that. I'm wondering how to troubleshoot the low speed.. Any idea? Turbo write is activated. Quote Link to comment
trurl Posted February 15, 2023 Share Posted February 15, 2023 59 minutes ago, Netix said: Any idea Possibly you disturbed connections when you removed the other drive. Attach diagnostics to your NEXT post in this thread Quote Link to comment
Netix Posted February 17, 2023 Share Posted February 17, 2023 (edited) On 2/15/2023 at 9:12 AM, trurl said: Possibly you disturbed connections when you removed the other drive. Attach diagnostics to your NEXT post in this thread Had an unsafe shutdown, had to run a parity check and just restarted the script. It still run at 1.5 mb/s.. Here's my diagnostics while the script is running Edited February 20, 2023 by Netix Quote Link to comment
trurl Posted February 17, 2023 Share Posted February 17, 2023 Feb 15 21:58:26 NetPlex kernel: critical medium error, dev sdd, sector 11878866632 op 0x0:(READ) flags 0x4000 phys_seg 56 prio class 0 Feb 15 21:58:26 NetPlex kernel: md: disk11 read error, sector=11878866568 Run an extended SMART self-test on disk11. On 2/15/2023 at 8:11 AM, Netix said: Shrink away another 8TB drive Looks like disk11 is unmountable, so maybe that is the one you are clearing. If so, you could just New Config to remove it and rebuild parity. Quote Link to comment
dp100 Posted February 20, 2023 Share Posted February 20, 2023 On 10/29/2016 at 5:56 PM, Squid said: Run A Custom Script At Parity Check / Rebuild Start And Stop Use it to run a custom script to (as an example), shut down various docker applications, etc. Adjust the variables within the script file. Note that you either need to run this in the background or at array start. Running this in the foreground will not work. #!/usr/bin/php <?PHP # A simple script to allow you to run a custom script when a parity check starts or stops # Adjust the following variables to suit: $checkInterval = 300; # Number of seconds in between checks $startScript = "full path to the script"; # The full path to the script to run when a parity check starts $stopScript = "full path to the stop script"; # The full path to the script to run when a parity check stops # Don't touch anything below while (true) { $vars = parse_ini_file("/var/local/emhttp/var.ini"); if ( $vars['mdState'] == "STOPPED" ) { break; } if ( ($vars['mdResyncPos'] != 0) && $vars ) { echo "Parity Check / Sync / Rebuild in progress. Executing the start script ($startScript)"; exec($startScript,$output); foreach ($output as $line) { echo $line."\n"; } while (true) { $vars = parse_ini_file("var/local/emhttp/var.ini"); if ( ($vars['mdResyncPos'] == 0) && $vars ) { echo "Parity Check / Sync / Rebuild finished. Executing the stop script ($stopScript)"; exec($stopScript,$output); foreach ($output as $line) { echo $line."\n"; } break; } else { sleep($checkInterval); } } } else { sleep($checkInterval); } } ?> custom_script_parity_check_start_stop.zip 1010 B · 49 downloads Hi Squid Does this script still work in 6.11.5 , 5 years later after this post? I'm trying to use it to trigger a basic script to backup my server and power-off but i just get errros when running it. If ti does still work, can i get an example of the correct syntax for an example of "full path the script" please? Thanks kindly. Quote Link to comment
Netix Posted February 20, 2023 Share Posted February 20, 2023 On 2/17/2023 at 8:58 AM, trurl said: Feb 15 21:58:26 NetPlex kernel: critical medium error, dev sdd, sector 11878866632 op 0x0:(READ) flags 0x4000 phys_seg 56 prio class 0 Feb 15 21:58:26 NetPlex kernel: md: disk11 read error, sector=11878866568 Run an extended SMART self-test on disk11. Looks like disk11 is unmountable, so maybe that is the one you are clearing. If so, you could just New Config to remove it and rebuild parity. Hey there. It passed the extended SMART self-test. Retried the script, still going at 1.5 mb/s.. what are my options ? I would really like to remove that drive without going 0 parity.. netplex-diagnostics-20230220-1116.zip WDC_WD80EMAZ-00WJTA0_7HJXZWMF-20230217-2146.txt Quote Link to comment
BeersTeddy Posted March 20, 2023 Share Posted March 20, 2023 On 1/7/2017 at 6:14 AM, Squid said: ok... How about this: (it's actually a lot simpler than it looks ) #!/usr/bin/php <?PHP # description=Moves a folder based upon utilization # arrayStarted=true $source = "/mnt/disk1/test"; # Note that mixing disk shares and user shares here will result in corrupted files $destination = "/mnt/disk2/test"; # Use either disk or user shares. Not both. $moveAt = 90; # Utilization % on the source to trigger the moves $moveOldest = true; # true moves the oldest files/folders first. false moves the newest files/folders first $emptySource = false; # false stops the moves when utilization drops below $moveAt. true will move all of the files / folders $runDuringCheck = false; # false pauses the moves during a parity check/rebuild. true continues copying $checkSleepTime = 300; # seconds to delay before checking if a parity check is still in progress $deleteDestination = true; # false if the destination file/folder already exists skips copying. true deletes the version on the destination and then copies $abortOnError = true; # true aborts move operations if one of them results in an error. false carries on with other files/folders $finishScript = false; # false do nothing. Set to something like "/boot/my_scripts/customScript.sh" to run a custom script at the completion of copying (notifications?) $fullLogging = false; # set to true for full logging. Useful for debugging. function runMove() { global $source, $moveAt; $percent = (disk_total_space($source) - disk_free_space($source)) / disk_total_space($source) * 100; return ($percent > $moveAt); } function logger($string) { global $fullLogging; if ( $fullLogging ) { echo $string; } } if ( ! runMove() ) { echo "Set conditions to move are not met. Exiting\n"; exit(); } $raw = array_diff(scandir($source),array(".","..")); if ( ! $raw ) { echo "$source does not exist or is already empty\n"; exit(); } foreach ($raw as $entry) { $sourceContents[$entry] = filemtime("$source/$entry"); } if ( $moveOldest ){ asort($sourceContents); } else { arsort($sourceContents); } logger(print_r($sourceContents,true)); $contents = array_keys($sourceContents); exec("mkdir -p ".escapeshellarg($destination)); foreach ( $contents as $entry ) { if ( ! $emptySource ) { if ( ! runMove() ) { break; } } if ( ! $runDuringCheck ) { while ( true ) { $unRaidVars = parse_ini_file("/var/local/emhttp/var.ini"); if ( ! $unRaidVars["mdResyncPos"] ) { break; } logger("Parity Check / Rebuild in progress. Pausing $checkSleepTime seconds\n"); sleep($checkSleepTime); } } if ( is_dir("$destination/$entry") ) { echo "$destination/$entry already exists. "; if ( $deleteDestination ) { echo "Deleting prior to moving.\n"; exec("rm -rf ".escapeshellarg("$destination/$entry")); } else { echo "Skipping.\n"; continue; } } echo "Moving $source/$entry to $destination/$entry\n"; exec("mv ".escapeshellarg("$source/$entry")." ".escapeshellarg("$destination/$entry"),$output,$returnValue); if ( $returnValue ) { echo "An error occurred moving $source/$entry to $destination/$entry "; if ( $abortOnError ) { echo "Aborting\n"; exit(); } else { echo "Continuing\n"; } } } if ( $finishScript ) { exec($finishScript,$finishOut); foreach ($finishOut as $line) { echo "$line\n"; } } ?> Allows you to set the threshold of utilization on the source to trigger the move Moves are selectable to either completely move the source or to stop after the threshold has been reached Move either the oldest folders or the newest folders first Option to pause during a parity check / rebuild Option to skip if the folder to be moved already exists in the destination or to delete it and copy Option to skip or abort if an error happens during the copy Option to run a custom script (ie: notifications) upon completion. This is really usefully script. I'm wondering if there is any chance to add an option to move the folder only if the files inside (inc subfolders are NOT hard linked. Basically, to move unique files only, as moving hardlinks in between the drives makes a copy of the file. In result even more space is taken. I'm using this to find not hardlinked media files find /mnt/user/data/media* -type f -not -path "*/Scenes/*" -not -path "*/Behind The Scenes/*" -not -path "*/Trailers/*" -not -path "*/Featurettes/*" -not -path "*/Other/*" \( -iname \*.mp4 -o -iname \*.mkv ! -iname "*gag*" ! -iname "*sample*" ! -iname "*blooper*" ! -iname "*Outtake*" \) -links 1 -print | sort Quote Link to comment
nico_francois Posted April 4, 2023 Share Posted April 4, 2023 On 9/4/2016 at 2:06 AM, RobJ said: Clear an unRAID array data drive (for the Shrink array wiki page) This script is for use in clearing a drive that you want to remove from the array, while maintaining parity protection. I've added a set of instructions within the Shrink array wiki page for it. It is designed to be as safe as possible, and will not run unless specific conditions are met - - The drive must be a data drive that is a part of an unRAID array - It must be a good drive, mounted in the array, capable of every sector being zeroed (no bad sectors) - The drive must be completely empty, no data at all left on it. This is tested for! - The drive should have a single root folder named clear-me - exactly 8 characters, 7 lowercase and 1 hyphen. This is tested for! Great script! Worked like a charm for me when I wanted to remove a disk to reformat it. But I was wondering if it would be possible to write the same marker as preclearing a disk does at the end of the script? Because after I removed the disk I still had to preclear it (basically a second time) -- which was a total waste of X extra hours 😬 Quote Link to comment
trurl Posted April 4, 2023 Share Posted April 4, 2023 Sounds like you added the disk back after removing it. If all you were trying to accomplish was formatting the disk there was no reason to remove it from the array. And after you add it back you still have to format it in the array. https://wiki.unraid.net/Manual/Storage_Management#Reformatting_a_drive Quote Link to comment
nico_francois Posted April 4, 2023 Share Posted April 4, 2023 Ah, excellent. And I take it this will not force a full parity sync afterwards then? But do I even need to run the clear-me script at all then? 🤔 Quote Link to comment
war4peace Posted April 21, 2023 Share Posted April 21, 2023 I am trying to use the script to zero out Disck #6 from my array. Followed all instructions, emptied the drive using Unbalance, drive is now empty. I created a folder called 'clear-me', exactly as specified. Running the script yields the following: root@Tower:/boot/config/cleardrive# sh clear_array_drive *** Clear an unRAID array data drive *** v1.4 Checked 6 drives, did not find an empty drive ready and marked for clearing! To use this script, the drive must be completely empty first, no files or folders left on it. Then a single folder should be created on it with the name 'clear-me', exactly 8 characters, 7 lowercase and 1 hyphen. This script is only for clearing unRAID data drives, in preparation for removing them from the array. It does not add a Preclear signature. Could it be the way I created the folder? I used this command from Terminal: cd /mnt/disk6/ mkdir clear-me The disk is empty and freshly formatted, with just that folder on it. root@Tower:/boot/config/cleardrive# du /mnt/disk6 0 /mnt/disk6/clear-me 16 /mnt/disk6 Any idea why the script dislikes the disk/folder? Quote Link to comment
DjJoakim Posted April 28, 2023 Share Posted April 28, 2023 On 10/29/2016 at 6:56 PM, Squid said: Run A Custom Script At Parity Check / Rebuild Start And Stop Use it to run a custom script to (as an example), shut down various docker applications, etc. Adjust the variables within the script file. Note that you either need to run this in the background or at array start. Running this in the foreground will not work. #!/usr/bin/php <?PHP # A simple script to allow you to run a custom script when a parity check starts or stops # Adjust the following variables to suit: $checkInterval = 300; # Number of seconds in between checks $startScript = "full path to the script"; # The full path to the script to run when a parity check starts $stopScript = "full path to the stop script"; # The full path to the script to run when a parity check stops # Don't touch anything below while (true) { $vars = parse_ini_file("/var/local/emhttp/var.ini"); if ( $vars['mdState'] == "STOPPED" ) { break; } if ( ($vars['mdResyncPos'] != 0) && $vars ) { echo "Parity Check / Sync / Rebuild in progress. Executing the start script ($startScript)"; exec($startScript,$output); foreach ($output as $line) { echo $line."\n"; } while (true) { $vars = parse_ini_file("var/local/emhttp/var.ini"); if ( ($vars['mdResyncPos'] == 0) && $vars ) { echo "Parity Check / Sync / Rebuild finished. Executing the stop script ($stopScript)"; exec($stopScript,$output); foreach ($output as $line) { echo $line."\n"; } break; } else { sleep($checkInterval); } } } else { sleep($checkInterval); } } ?> custom_script_parity_check_start_stop.zip 1010 B · 51 downloads Sorry for bumping this old post, but this dosen't seem to be working anymore. Does anyone have a another solution like this? Or maybe i am just doing it wrong, but i can't get it working. Thanks! Quote Link to comment
guru69 Posted April 29, 2023 Share Posted April 29, 2023 Script to recover corrupt Radarr or Sonarr databases Recently my radarr and sonarr logs have been showing: ...Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): database disk image is malformed Hopefully the cause of the corruption is discovered soon. #!/bin/bash # Script to recover / recreate radarr/sonarr database when log shows: # ...Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): database disk image is malformed # # Don't forget that both radarr/sonarr create zipped db backups in /Backups/scheduled folder # Which can be restored if this recovery fails # Set your paths/names for radarr/sonarr dockername=radarr dockerpath=/mnt/user/appdata/radarr dockerdbname=radarr.db # Stop radarr/sonarr docker docker stop $dockername > /dev/null echo "$dockername is stopped" # Perform sqlite3 .recover into new database file sqlite3 $dockerpath/$dockerdbname .recover | sqlite3 $dockerpath/$dockername-recover.db # Rename any db-shm or wal files mv $dockerpath/$dockerdbname-shm $dockerpath/$dockerdbname-shm-BAD mv $dockerpath/$dockerdbname-wal $dockerpath/$dockerdbname-wal-BAD # Rename the corrupt database mv $dockerpath/$dockerdbname $dockerpath/$dockerdbname-BAD # Move recovered database into place mv $dockerpath/$dockername-recover.db $dockerpath/$dockerdbname # Fix ownership on newly recovered database chown nobody:users $dockerpath/$dockerdbname # Start radarr/sonarr docker docker start $dockername > /dev/null echo "$dockername is started" # Check docker log and web GUI # Optionally run this to clean up # rm $dockerpath/*-BAD 1 Quote Link to comment
DjJoakim Posted April 30, 2023 Share Posted April 30, 2023 On 4/28/2023 at 11:03 PM, DjJoakim said: Sorry for bumping this old post, but this dosen't seem to be working anymore. Does anyone have a another solution like this? Or maybe i am just doing it wrong, but i can't get it working. Thanks! So if anyone else bumps into problem with this script, on line 24 there is a / missing, and the script will give you errors for that. So add / infront of var/local/emhttp/var.ini on line 24. If you get permission errors like i did, add "bash" to the pathway of the running and stopping script, like "bash /path/to/script/" Quote Link to comment
T0rqueWr3nch Posted April 30, 2023 Share Posted April 30, 2023 On 9/3/2016 at 7:06 PM, RobJ said: Clear an unRAID array data drive (for the Shrink array wiki page) While preparing to shrink my array, I had a question which I didn't see documented on the wiki or in @RobJ's zeroing script post. If we are zeroing the data disk, shouldn't we disable the mover? Otherwise, don't we run the risk of data loss if the mover runs and moves data to the disk being zeroed? Quote Link to comment
itimpi Posted April 30, 2023 Share Posted April 30, 2023 11 minutes ago, T0rqueWr3nch said: While preparing to shrink my array, I had a question which I didn't see documented on the wiki or in @RobJ's zeroing script post. If we are zeroing the data disk, shouldn't we disable the mover? Otherwise, don't we run the risk of data loss if the mover runs and moves data to the disk being zeroed? I doubt if that is a problem as the zeroing process is going to almost immediately destroy the file system on the drive so it would not be possible to write file to the drive. I have not checked but I would expect the script to also have unmounted the drive before it started zeroing it. 1 Quote Link to comment
T0rqueWr3nch Posted April 30, 2023 Share Posted April 30, 2023 47 minutes ago, itimpi said: I doubt if that is a problem as the zeroing process is going to almost immediately destroy the file system on the drive so it would not be possible to write file to the drive. I have not checked but I would expect the script to also have unmounted the drive before it started zeroing it. You're right: # Perform the clearing logger -tclear_array_drive "Clear an unRAID array data drive v$version" echo -e "\rUnmounting Disk ${d:9} ..." logger -tclear_array_drive "Unmounting Disk ${d:9} (command: umount $d ) ..." umount $d echo -e "Clearing Disk ${d:9} ..." Thank you! Quote Link to comment
Lordbye Posted May 3, 2023 Share Posted May 3, 2023 (edited) On 12/25/2022 at 5:48 AM, JoeUnraidUser said: Script to trim Docker logs to 1 Megabyte. #!/bin/bash size=1M function trimLog { file=$1 temp="$file.$(date +%s%N).tmp" time=$(date --rfc-3339='seconds') before=$(du -sh "$file" | cut -f1) echo -n "$time: $file: $before=>" tail --bytes=$size "$file" > "$temp" chown $(stat -c '%U' "$file"):$(stat -c '%G' "$file") "$temp" chmod $(stat -c "%a" "$file") "$temp" mv "$temp" "$file" after=$(du -sh "$file" | cut -f1) echo "$after" } find "/var/lib/docker/containers" -name "*.log" -size +$size 2>/dev/null | sort -f |\ while read file; do trimLog "$file"; done trimDockerLogs 531 B · 243 downloads Hi , i'm using yoru script, and for a little time it is ok, now i have a problem log is growing anyway, but i don't know..where...or which file because: root@MyNas:/var/log# df /var/log/ Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 262144 18836 243308 8% /var/log ----------------------------------- root@MyNas:/var/log# du -mh -c 0 ./pwfail 152K ./unraid-api 0 ./swtpm/libvirt/qemu 0 ./swtpm/libvirt 0 ./swtpm 0 ./samba/cores/rpcd_lsad 0 ./samba/cores/samba-dcerpcd 0 ./samba/cores/winbindd 0 ./samba/cores/nmbd 0 ./samba/cores/smbd 0 ./samba/cores 212K ./samba 0 ./plugins 0 ./pkgtools/removed_uninstall_scripts 4.0K ./pkgtools/removed_scripts 12K ./pkgtools/removed_packages 16K ./pkgtools 4.0K ./nginx 0 ./nfsd 40K ./libvirt/qemu 0 ./libvirt/ch 76K ./libvirt 796K . 796K total --------------------- root@LordbyeNas:/var/log# ls -lha total 336K drwxr-xr-x 11 root root 740 May 2 16:21 ./ drwxr-xr-x 15 root root 360 Dec 31 2019 ../ -rw------- 1 root root 0 Nov 20 22:25 btmp -rw-r--r-- 1 root root 0 Apr 28 2021 cron -rw-r--r-- 1 root root 0 Apr 28 2021 debug -rw-r--r-- 1 root root 71K May 1 19:42 dmesg -rw-r--r-- 1 root root 20K May 3 07:02 docker.log -rw-r--r-- 1 root root 6.9K May 1 19:43 faillog -rw-r--r-- 1 root root 67 May 3 08:24 gitcount -rw-r--r-- 1 root root 12K May 3 08:24 gitflash -rw-r--r-- 1 root root 63K May 1 19:43 lastlog drwxr-xr-x 4 root root 140 May 1 19:44 libvirt/ -rw-r--r-- 1 root root 358 May 2 00:07 maillog -rw-r--r-- 1 root root 0 May 1 19:42 mcelog -rw-r--r-- 1 root root 0 Apr 28 2021 messages drwxr-xr-x 2 root root 40 Aug 10 2022 nfsd/ drwxr-x--- 2 nobody root 60 May 1 19:43 nginx/ lrwxrwxrwx 1 root root 24 Nov 20 22:24 packages -> ../lib/pkgtools/packages/ drwxr-xr-x 5 root root 100 May 1 19:43 pkgtools/ drwxr-xr-x 2 root root 980 May 3 08:00 plugins/ drwxr-xr-x 2 root root 40 May 3 16:24 pwfail/ lrwxrwxrwx 1 root root 25 Nov 20 22:26 removed_packages -> pkgtools/removed_packages/ lrwxrwxrwx 1 root root 24 Nov 20 22:26 removed_scripts -> pkgtools/removed_scripts/ lrwxrwxrwx 1 root root 34 May 1 19:43 removed_uninstall_scripts -> pkgtools/removed_uninstall_scripts/ drwxr-xr-x 3 root root 340 May 3 16:24 samba/ -rw-r--r-- 1 root root 33 Dec 31 2019 scan lrwxrwxrwx 1 root root 23 Nov 20 22:24 scripts -> ../lib/pkgtools/scripts/ -rw-r--r-- 1 root root 0 Apr 28 2021 secure lrwxrwxrwx 1 root root 21 Nov 20 22:24 setup -> ../lib/pkgtools/setup/ -rw-r--r-- 1 root root 0 Apr 28 2021 spooler drwxr-xr-x 3 root root 60 Sep 27 2022 swtpm/ -rw-r--r-- 1 root root 100K May 2 16:21 syslog -rw-r--r-- 1 root root 100K May 2 16:21 syslog.1 drwxr-xr-x 2 root root 80 May 2 16:21 unraid-api/ -rw-r--r-- 1 root root 0 May 1 19:42 vfio-pci -rw-r--r-- 1 root root 587 May 1 19:42 wg-quick.log -rw-rw-r-- 1 root utmp 6.8K May 1 19:43 wtmp i don't undestand where is the difference from 796k to 18836 K... Edited May 3, 2023 by Lordbye Quote Link to comment
JoeUnraidUser Posted May 4, 2023 Share Posted May 4, 2023 12 hours ago, Lordbye said: Hi , i'm using yoru script, and for a little time it is ok, now i have a problem log is growing anyway, but i don't know..where...or which file because: root@MyNas:/var/log# df /var/log/ Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 262144 18836 243308 8% /var/log ----------------------------------- root@MyNas:/var/log# du -mh -c 0 ./pwfail 152K ./unraid-api 0 ./swtpm/libvirt/qemu 0 ./swtpm/libvirt 0 ./swtpm 0 ./samba/cores/rpcd_lsad 0 ./samba/cores/samba-dcerpcd 0 ./samba/cores/winbindd 0 ./samba/cores/nmbd 0 ./samba/cores/smbd 0 ./samba/cores 212K ./samba 0 ./plugins 0 ./pkgtools/removed_uninstall_scripts 4.0K ./pkgtools/removed_scripts 12K ./pkgtools/removed_packages 16K ./pkgtools 4.0K ./nginx 0 ./nfsd 40K ./libvirt/qemu 0 ./libvirt/ch 76K ./libvirt 796K . 796K total --------------------- root@LordbyeNas:/var/log# ls -lha total 336K drwxr-xr-x 11 root root 740 May 2 16:21 ./ drwxr-xr-x 15 root root 360 Dec 31 2019 ../ -rw------- 1 root root 0 Nov 20 22:25 btmp -rw-r--r-- 1 root root 0 Apr 28 2021 cron -rw-r--r-- 1 root root 0 Apr 28 2021 debug -rw-r--r-- 1 root root 71K May 1 19:42 dmesg -rw-r--r-- 1 root root 20K May 3 07:02 docker.log -rw-r--r-- 1 root root 6.9K May 1 19:43 faillog -rw-r--r-- 1 root root 67 May 3 08:24 gitcount -rw-r--r-- 1 root root 12K May 3 08:24 gitflash -rw-r--r-- 1 root root 63K May 1 19:43 lastlog drwxr-xr-x 4 root root 140 May 1 19:44 libvirt/ -rw-r--r-- 1 root root 358 May 2 00:07 maillog -rw-r--r-- 1 root root 0 May 1 19:42 mcelog -rw-r--r-- 1 root root 0 Apr 28 2021 messages drwxr-xr-x 2 root root 40 Aug 10 2022 nfsd/ drwxr-x--- 2 nobody root 60 May 1 19:43 nginx/ lrwxrwxrwx 1 root root 24 Nov 20 22:24 packages -> ../lib/pkgtools/packages/ drwxr-xr-x 5 root root 100 May 1 19:43 pkgtools/ drwxr-xr-x 2 root root 980 May 3 08:00 plugins/ drwxr-xr-x 2 root root 40 May 3 16:24 pwfail/ lrwxrwxrwx 1 root root 25 Nov 20 22:26 removed_packages -> pkgtools/removed_packages/ lrwxrwxrwx 1 root root 24 Nov 20 22:26 removed_scripts -> pkgtools/removed_scripts/ lrwxrwxrwx 1 root root 34 May 1 19:43 removed_uninstall_scripts -> pkgtools/removed_uninstall_scripts/ drwxr-xr-x 3 root root 340 May 3 16:24 samba/ -rw-r--r-- 1 root root 33 Dec 31 2019 scan lrwxrwxrwx 1 root root 23 Nov 20 22:24 scripts -> ../lib/pkgtools/scripts/ -rw-r--r-- 1 root root 0 Apr 28 2021 secure lrwxrwxrwx 1 root root 21 Nov 20 22:24 setup -> ../lib/pkgtools/setup/ -rw-r--r-- 1 root root 0 Apr 28 2021 spooler drwxr-xr-x 3 root root 60 Sep 27 2022 swtpm/ -rw-r--r-- 1 root root 100K May 2 16:21 syslog -rw-r--r-- 1 root root 100K May 2 16:21 syslog.1 drwxr-xr-x 2 root root 80 May 2 16:21 unraid-api/ -rw-r--r-- 1 root root 0 May 1 19:42 vfio-pci -rw-r--r-- 1 root root 587 May 1 19:42 wg-quick.log -rw-rw-r-- 1 root utmp 6.8K May 1 19:43 wtmp i don't undestand where is the difference from 796k to 18836 K... The script trims the Docker logs in the "/var/lib/docker/containers" directory. The script doesn't trim any log files in the "/var/log" directory. You could easily adapt the script to trim the logs in the "/var/log" directory. I am not sure why you are seeing different usage numbers. Quote Link to comment
Lordbye Posted May 4, 2023 Share Posted May 4, 2023 3 hours ago, JoeUnraidUser said: The script trims the Docker logs in the "/var/lib/docker/containers" directory. The script doesn't trim any log files in the "/var/log" directory. You could easily adapt the script to trim the logs in the "/var/log" directory. I am not sure why you are seeing different usage numbers. Sorry, i didn't put my script size=100k function trimLog { file=$1 temp="$file.$(date +%s%N).tmp" time=$(date --rfc-3339='seconds') before=$(du -sh "$file" | cut -f1) echo -n "$time: $file: $before=>" tail --bytes=$size "$file" > "$temp" chown $(stat -c '%U' "$file"):$(stat -c '%G' "$file") "$temp" chmod $(stat -c "%a" "$file") "$temp" mv "$temp" "$file" after=$(du -sh "$file" | cut -f1) echo "$after" } find /var/log -maxdepth 5 -type f -size +$size 2>/dev/null | sort -f |\ while read file; do trimLog "$file"; done find "/boot/logs" "/var/log" "/var/lib/docker/containers" -name "*.log" "*log" -size +$size 2>/dev/null | sort -f |\ while read file; do trimLog "$file"; done Quote Link to comment
mamaraci Posted May 10, 2023 Share Posted May 10, 2023 On 9/4/2016 at 3:06 AM, RobJ said: Clear an unRAID array data drive (for the Shrink array wiki page) This script is for use in clearing a drive that you want to remove from the array, while maintaining parity protection. I've added a set of instructions within the Shrink array wiki page for it. It is designed to be as safe as possible, and will not run unless specific conditions are met Hello! Thanks for the script. Can I ask for the advice, how should I know if the script completed successfully? I was trying to remove Disk4 from the array, and was preparing it as per https://wiki.unraid.net/Shrink_array Method 2. I've left the tab with User's Script open over a night, but the web-client switched off during the night. How can I understand was the process completed successfully or not? If I should re-run it, would it work, if I run it with "Run in background", can the web-client be disconnected in that case? Initially I've run it with "Run Script" button, and failed to keep it open for such a long time. linertower-diagnostics-20230510-0857.zip Quote Link to comment
Goldmaster Posted May 14, 2023 Share Posted May 14, 2023 So after my fiasco with Plex. at 1st thought was a major bug in plexpass, which then continued to plex docker. I had followed along with the video on fixing a corrupt plex database. It got me wondering if i could write out a userscript that could automatically guide a user though and fix a plex database. currently only works with @binhex plex containers for now but may expand to other plex docker containers. This is the userscript link https://gitlab.com/Goldmaster/plex-database-fixer/-/blob/main/plex-database-fixer.sh I did write this with the help of chatgpt. so may be some issues. 1 Quote Link to comment
Recommended Posts
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.