January 20, 20251 yr For my script, the custom cron isn't working: I've set it to: 0 2 * * SUN This should run every sunday, but just realized, that it didn't. When I look into the log, last time was in december when I manually executed the script... What am I missing?
January 20, 20251 yr Anyone know of a good guide for setting a weekly script to update the cookies for myanonamouse?
January 21, 20251 yr I'm on the latest Unraid 7. I did upgrade from Unraid 6.12 to the beta of Unraid 7. During that time User Scripts was working as expected. Once I upgraded to I think rc2 was when I noticed it that when I click the Show Log button a window pops up and shows just a button that says undefined. Previously it would show a log or out of the script running. I know I can go and ssh and find that log file but I was hoping when the official version came out this would have been fixed. Any advice would be greatly appreciated.
January 23, 20251 yr I have a decent number of scripts at this point, but a handful I'd really like a way to access from the Dashboard instead of going to Settings -> User Scripts -> digging through my list. Is it possible to pin certain scripts to the Dashboard in any way?
January 31, 20251 yr Is there a way to have a script automatically run in background at startup? I know I can click run in background but do I have to manually do that after every reboot? Thank you!
January 31, 20251 yr 2 minutes ago, swtz said: Is there a way to have a script automatically run in background at startup? I know I can click run in background but do I have to manually do that after every reboot? Thank you! you saw the option "at 1st array start only" ? or doesnt this fit your needs ?
January 31, 20251 yr 8 minutes ago, alturismo said: you saw the option "at 1st array start only" ? or doesnt this fit your needs ? Is that for running it in the background? or is that just for running it once and being done?
January 31, 20251 yr 9 minutes ago, swtz said: Is that for running it in the background? or is that just for running it once and being done? it runs once on startup in the background (same like when you click once run in background)
February 2, 20251 yr I've had issues since v6 (now on v7) with restarting my system. Basically for one reason or another the array won't shutdown cleanly. I created a userscript which ensures a clean dismount of the array by stopping everything. To date has worked without fail. But only if I run it manually and then stop the array. I've tried having it set as "run at array shutdown" but it doesn't run and I'm not sure why as I believe this is how it should work? I.e. I click "shutdown array" and this script should first run. Is that the case?
February 3, 20251 yr 6 hours ago, Davo67 said: But only if I run it manually and then stop the array. does it also work when u run it manually in background and then stop ?
February 3, 20251 yr 17 hours ago, alturismo said: does it also work when u run it manually in background and then stop ? Yes to date it always works. The issue isn't the script, but that I don't think it runs when I click "shutdown array" or "reboot system". Certainly I'm still having issues. Yesterday I ran the script then rebooted the system. All smooth, 5 minutes later was back up. Then there was an update that needed a restart and just did "reboot system". I don't believe the script ran and although the system did eventually restart without a power off/on needed (an improvement in v7) the array was marked as unclean so it clearly forced the shutdown. I can't see where I can check logs for my script or userscripts in general. There doesn't seem to be any documentation available (that I can find) - for support it points to this thread. Edited February 3, 20251 yr by Davo67
February 4, 20251 yr 4 hours ago, Davo67 said: Yes to date it always works. The issue isn't the script, but that I don't think it runs when I click "shutdown array" or "reboot system". Certainly I'm still having issues. Yesterday I ran the script then rebooted the system. All smooth, 5 minutes later was back up. Then there was an update that needed a restart and just did "reboot system". I don't believe the script ran and although the system did eventually restart without a power off/on needed (an improvement in v7) the array was marked as unclean so it clearly forced the shutdown. I can't see where I can check logs for my script or userscripts in general. There doesn't seem to be any documentation available (that I can find) - for support it points to this thread. Just further to this, looking at the syslog output below it looks like the userscript isn't being run until a lot of other processes have run. And this has been where the system has failed (and what the script avoids). So I'm not sure there is a way around this. Feb 4 13:36:02 DavoUnraid kernel: mdcmd (40): nocheck cancel Feb 4 13:36:03 DavoUnraid emhttpd: Spinning up all drives... Feb 4 13:36:03 DavoUnraid emhttpd: spinning up /dev/sda Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdh Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdg Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdd Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sde Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdb Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdf Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdc Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/nvme1n1 Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/nvme0n1 Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sda Feb 4 13:36:13 DavoUnraid emhttpd: Stopping services... Feb 4 13:36:13 DavoUnraid usb_manager: Info: rc.usb_manager Reset Connected Status Feb 4 13:36:13 DavoUnraid emhttpd: shcmd (75809): /etc/rc.d/rc.libvirt stop Feb 4 13:36:13 DavoUnraid rc.libvirt: Stopping libvirt daemon... Feb 4 13:36:14 DavoUnraid rc.libvirt: virsh net-destroy d2cdc0e3-89b3-49d3-825f-2e04c1c0f184 Feb 4 13:36:14 DavoUnraid dnsmasq[21844]: exiting on receipt of SIGTERM Feb 4 13:36:15 DavoUnraid rc.libvirt: libvirt daemon... Stopped. Feb 4 13:36:15 DavoUnraid rc.libvirt: Stopping virtlog daemon... Feb 4 13:36:16 DavoUnraid rc.libvirt: virtlog daemon... Stopped. Feb 4 13:36:16 DavoUnraid rc.libvirt: Stopping virtlock daemon... Feb 4 13:36:17 DavoUnraid rc.libvirt: virtlock daemon... Stopped. Feb 4 13:36:18 DavoUnraid emhttpd: shcmd (75810): umount /etc/libvirt Feb 4 13:36:18 DavoUnraid kernel: BTRFS info (device loop3): last unmount of filesystem 6fb45768-fade-4fc3-9937-9eca695e5285 Feb 4 13:36:18 DavoUnraid emhttpd: shcmd (75812): /etc/rc.d/rc.docker stop Feb 4 13:36:18 DavoUnraid rc.docker: Stopping containers... Feb 4 13:36:18 DavoUnraid rc.docker: Unraid managed containers stopped. Feb 4 13:36:18 DavoUnraid rc.docker: Stopping network... Feb 4 13:36:19 DavoUnraid rc.docker: Network stopped. Feb 4 13:36:19 DavoUnraid rc.docker: Stopping Docker daemon... Feb 4 13:36:19 DavoUnraid root: Waiting 30 seconds for Docker daemon to die. Feb 4 13:36:26 DavoUnraid rc.docker: ip link set docker0 down Feb 4 13:36:26 DavoUnraid rc.docker: ip link del docker0 Feb 4 13:36:26 DavoUnraid rc.docker: Docker daemon... Stopped. Feb 4 13:36:26 DavoUnraid emhttpd: shcmd (75814): umount --lazy /var/lib/docker Feb 4 13:36:30 DavoUnraid kernel: ccp 0000:30:00.2: tee enabled Feb 4 13:36:30 DavoUnraid kernel: ccp 0000:30:00.2: psp enabled Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: TSC scaling supported Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Nested Virtualization enabled Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Nested Paging enabled Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: LBR virtualization supported Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Virtual VMLOAD VMSAVE supported Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Virtual GIF supported Feb 4 13:36:31 DavoUnraid kernel: BTRFS info (device loop2): last unmount of filesystem 82241304-4c3b-4d2c-b308-45e2a74c2b46 Feb 4 13:36:32 DavoUnraid unassigned.devices: Unmounting All Devices... Feb 4 13:36:32 DavoUnraid sudo: pam_unix(sudo:session): session closed for user root Feb 4 13:36:33 DavoUnraid unraid.usbip-gui: Stopping Daemon(USBIPD) Feb 4 13:36:33 DavoUnraid emhttpd: /usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/00000001/script" >/dev/null 2>&1/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/test_array_shutdown/script" >/dev/null 2>&1 Feb 4 13:36:33 DavoUnraid rc.samba: Stopping Samba server daemon... Feb 4 13:36:33 DavoUnraid rc.samba: Samba server daemon... Already stopped. Feb 4 13:36:33 DavoUnraid rc.nfsd: Stopping NFS server daemon... Feb 4 13:36:34 DavoUnraid rc.nfsd: NFS server daemon... Already stopped. Feb 4 13:36:35 DavoUnraid emhttpd: Stopping mover... Feb 4 13:36:35 DavoUnraid emhttpd: shcmd (75817): /usr/local/sbin/mover stop Feb 4 13:36:35 DavoUnraid root: ionice -c 2 -n 0 nice -n 0 /usr/local/sbin/mover.old stop Feb 4 13:36:35 DavoUnraid root: mover: not running
February 10, 20251 yr Working on an rclone script and I cannot get the script to read from the logs. It's been really challenging. I finally got it writing the log correctly, but now I get en error when I try to extract transferred and deleted counts from the log. (last two lines) Error is; grep: /config/logs/rclone_sync_log.txt: No such file or directory grep: /config/logs/rclone_sync_log.txt: No such file or directory But when I look in the log it is being written correctly. Thanks for any sugestions. #!/bin/bash # Define your rclone remote and paths LOCAL="unraid:/array/" REMOTE="Synology:/backup/" LOG_FILE="/config/logs/rclone_sync_log.txt" #LOG_FILE="/tmp/user.scripts/tmpScripts/Backup Plex Libraries/rclone_sync_log.txt" # Perform a dry run and save output to log file #rclone sync --dry-run "$LOCAL" "$REMOTE" -v > "$LOG_FILE" docker exec Nacho-Rclone-Native-GUI rclone sync --dry-run "$LOCAL" "$REMOTE" -v --log-file "$LOG_FILE" # Function to extract the first group of numbers extract_first_number() { echo "$1" | grep -Eo '[0-9]+' | head -1 } # Extract Transferred and Deleted counts from log file transferred_count=$(grep 'Transferred: [0-9]*' "$LOG_FILE" | tail -1 | extract_first_number) deleted_count=$(grep 'Deleted: [0-9]*' "$LOG_FILE" | tail -1 | extract_first_number)
February 10, 20251 yr 37 minutes ago, Kboogie said: docker exec Nacho-Rclone-Native-GUI rclone sync --dry-run "$LOCAL" "$REMOTE" -v --log-file "$LOG_FILE" You're giving that path to the app so that's within the container, your script is running on the host OS and doesn't have access to that. You'd have to add a path map to a folder, and configure both sides with their respective paths. Edited February 10, 20251 yr by Kilrah
February 11, 20251 yr Can we use user script on system shutdown ? only stop array is available (seems also good for it) .. Wanted to save fish-shell history file to boot disk ...
February 11, 20251 yr Probably since the update to V7 I have been missing the buttons to start the scripts and check the log files. Only the list on the left with the scripts is still there
February 11, 20251 yr On 2/4/2025 at 1:41 PM, Davo67 said: Just further to this, looking at the syslog output below it looks like the userscript isn't being run until a lot of other processes have run. And this has been where the system has failed (and what the script avoids). So I'm not sure there is a way around this. Feb 4 13:36:02 DavoUnraid kernel: mdcmd (40): nocheck cancel Feb 4 13:36:03 DavoUnraid emhttpd: Spinning up all drives... Feb 4 13:36:03 DavoUnraid emhttpd: spinning up /dev/sda Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdh Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdg Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdd Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sde Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdb Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdf Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sdc Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/nvme1n1 Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/nvme0n1 Feb 4 13:36:13 DavoUnraid emhttpd: read SMART /dev/sda Feb 4 13:36:13 DavoUnraid emhttpd: Stopping services... Feb 4 13:36:13 DavoUnraid usb_manager: Info: rc.usb_manager Reset Connected Status Feb 4 13:36:13 DavoUnraid emhttpd: shcmd (75809): /etc/rc.d/rc.libvirt stop Feb 4 13:36:13 DavoUnraid rc.libvirt: Stopping libvirt daemon... Feb 4 13:36:14 DavoUnraid rc.libvirt: virsh net-destroy d2cdc0e3-89b3-49d3-825f-2e04c1c0f184 Feb 4 13:36:14 DavoUnraid dnsmasq[21844]: exiting on receipt of SIGTERM Feb 4 13:36:15 DavoUnraid rc.libvirt: libvirt daemon... Stopped. Feb 4 13:36:15 DavoUnraid rc.libvirt: Stopping virtlog daemon... Feb 4 13:36:16 DavoUnraid rc.libvirt: virtlog daemon... Stopped. Feb 4 13:36:16 DavoUnraid rc.libvirt: Stopping virtlock daemon... Feb 4 13:36:17 DavoUnraid rc.libvirt: virtlock daemon... Stopped. Feb 4 13:36:18 DavoUnraid emhttpd: shcmd (75810): umount /etc/libvirt Feb 4 13:36:18 DavoUnraid kernel: BTRFS info (device loop3): last unmount of filesystem 6fb45768-fade-4fc3-9937-9eca695e5285 Feb 4 13:36:18 DavoUnraid emhttpd: shcmd (75812): /etc/rc.d/rc.docker stop Feb 4 13:36:18 DavoUnraid rc.docker: Stopping containers... Feb 4 13:36:18 DavoUnraid rc.docker: Unraid managed containers stopped. Feb 4 13:36:18 DavoUnraid rc.docker: Stopping network... Feb 4 13:36:19 DavoUnraid rc.docker: Network stopped. Feb 4 13:36:19 DavoUnraid rc.docker: Stopping Docker daemon... Feb 4 13:36:19 DavoUnraid root: Waiting 30 seconds for Docker daemon to die. Feb 4 13:36:26 DavoUnraid rc.docker: ip link set docker0 down Feb 4 13:36:26 DavoUnraid rc.docker: ip link del docker0 Feb 4 13:36:26 DavoUnraid rc.docker: Docker daemon... Stopped. Feb 4 13:36:26 DavoUnraid emhttpd: shcmd (75814): umount --lazy /var/lib/docker Feb 4 13:36:30 DavoUnraid kernel: ccp 0000:30:00.2: tee enabled Feb 4 13:36:30 DavoUnraid kernel: ccp 0000:30:00.2: psp enabled Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: TSC scaling supported Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Nested Virtualization enabled Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Nested Paging enabled Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: LBR virtualization supported Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Virtual VMLOAD VMSAVE supported Feb 4 13:36:30 DavoUnraid kernel: kvm_amd: Virtual GIF supported Feb 4 13:36:31 DavoUnraid kernel: BTRFS info (device loop2): last unmount of filesystem 82241304-4c3b-4d2c-b308-45e2a74c2b46 Feb 4 13:36:32 DavoUnraid unassigned.devices: Unmounting All Devices... Feb 4 13:36:32 DavoUnraid sudo: pam_unix(sudo:session): session closed for user root Feb 4 13:36:33 DavoUnraid unraid.usbip-gui: Stopping Daemon(USBIPD) Feb 4 13:36:33 DavoUnraid emhttpd: /usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/00000001/script" >/dev/null 2>&1/usr/local/emhttp/plugins/user.scripts/backgroundScript.sh "/tmp/user.scripts/tmpScripts/test_array_shutdown/script" >/dev/null 2>&1 Feb 4 13:36:33 DavoUnraid rc.samba: Stopping Samba server daemon... Feb 4 13:36:33 DavoUnraid rc.samba: Samba server daemon... Already stopped. Feb 4 13:36:33 DavoUnraid rc.nfsd: Stopping NFS server daemon... Feb 4 13:36:34 DavoUnraid rc.nfsd: NFS server daemon... Already stopped. Feb 4 13:36:35 DavoUnraid emhttpd: Stopping mover... Feb 4 13:36:35 DavoUnraid emhttpd: shcmd (75817): /usr/local/sbin/mover stop Feb 4 13:36:35 DavoUnraid root: ionice -c 2 -n 0 nice -n 0 /usr/local/sbin/mover.old stop Feb 4 13:36:35 DavoUnraid root: mover: not running Any chance of some assistance with this please?
February 11, 20251 yr 13 hours ago, Masterwishx said: Can we use user script on system shutdown ? only stop array is available (seems also good for it) .. Wanted to save fish-shell history file to boot disk ... Why not use the "stop" file? Doesn't exist by default, but if you create a file formatted the same as the go file in the same location (USB boot stick) it will be run on shutdown.
February 12, 20251 yr 10 hours ago, JonathanM said: Why not use the "stop" file? Doesn't exist by default, but if you create a file formatted the same as the go file in the same location (USB boot stick) it will be run on shutdown. Thanks , first time hear of `stop` file , do we have this in docs ? seems `on stop array` also working but not `at_first_array_start_only` because script run before the file system exist , maybe `at_start_up_array` will work ... Edited February 12, 20251 yr by Masterwishx
February 12, 20251 yr 10 hours ago, JonathanM said: it will be run on shutdown. When still file system is exist befor shutdown? so we have also `start` file , or only `go`?
February 12, 20251 yr 5 hours ago, Masterwishx said: When still file system is exist befor shutdown? so we have also `start` file , or only `go`? Does this help?
February 14, 20251 yr Hey guys I got a short question. I created a small bash script with user scripts that should set alias values on array startup. The values are set but trying to load the changes does not work with source /root/.bashrc because it is executed in the script. As I can not do anything about the execution of the script, I don't know how to fix it. I cannot call the script with the dot notation like this: . /root/.bashrc Any ideas?
February 16, 20251 yr On 2/11/2025 at 4:31 PM, Ralf Hammeran said: Probably since the update to V7 I have been missing the buttons to start the scripts and check the log files. Only the list on the left with the scripts is still there Fixed ... do not use very long descriptions or seperate lines with <br> .... Edited February 18, 20251 yr by Ralf Hammeran
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.