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.

[Plugin] CA User Scripts

Featured Replies

Yes, it's tied to the "start array" button, which now is pretty much "start Unraid services" but... name's still what it is.

  • 3 weeks later...
  • Replies 2.1k
  • Views 567k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • I could make up something long, convoluted, and technical as a reason why it doesn't do that but it would all be bs.  The simple answer is that when I did this, I never thought of that, and why it sti

  • Hi All - We have a fix and are publishing a Connect plugin update to fix it today. Thanks for letting us know.

  • @Squid I tried many commands and by that I found out that pkill does not kill (all) child processes: root@Thoth:/tmp# pgrep -f isleep2m | xargs --no-run-if-empty ps fp PID TTY STAT T

Posted Images

Summary
The User Scripts plugin shows a “Custom” schedule (*/30 * * * *) and “Run in background,” but no cron entry is created. Scripts run manually fine, yet never run on schedule.


Environment

  • Unraid: 7.1.4 (Pro)

  • User Scripts plugin: current as of 26 Oct 2025 (standard; not Enhanced)

  • Hardware: standard build (nothing exotic)


The script (works manually)

Script path:

/boot/config/plugins/user.scripts/scripts/Tailscale Serve Reapply/script

What it does: resets Tailscale “serve” table and reapplies mappings; runs docker exec nextcloud occ status; writes a log to:

/var/log/tailscale-serve-reapply.log

Manual run works:

/boot/config/plugins/user.scripts/scripts/Tailscale\ Serve\ Reapply/script
tailscale serve status   # shows expected ports

Expected vs actual

  • Expected: After setting Schedule → Custom → */30 * * * * and clicking Apply, the plugin writes a cron entry and the script runs every 30 minutes.

  • Actual: The UI looks set, but there is no cron entry anywhere, and the script never runs on schedule.

Evidence:

# cron is alive
pgrep -x crond

# /boot is writable
mount | grep ' /boot '
touch /boot/.rwtest && echo OK && rm /boot/.rwtest

# no cron entry created
grep -H . /etc/cron.d/* /var/spool/cron/* /var/spool/cron/crontabs/* 2>/dev/null || echo "no cron entries"

Results: cron running, /boot RW, but no user-scripts cron line present.


Reproduction steps

  1. Create script under User Scripts → “Tailscale Serve Reapply.”

  2. Set Schedule: Custom, value */30 * * * *. Tick Run in background.

  3. Click Apply.

  4. Check cron paths above. No entry is created. Script only runs manually.


Notes / likely causes seen by other users

  • Scripts with names containing ! or () can break the gear menu and/or scheduler for all scripts. Renaming those directories under /boot/config/plugins/user.scripts/scripts/ can restore saving behavior.

  • Some users report missing csrf_token in logs when clicking Apply; schedules then fail to save.

  • The plugin executes scripts from /tmp/user.scripts/tmpScripts/... via PHP; PATH differences are normal, but unrelated to schedules not writing.


Workaround (safe, reversible)

Wire the cron entry directly and recreate it at boot (without moving or renaming the script).

Add a cron snippet now:

SCRIPT="/boot/config/plugins/user.scripts/scripts/Tailscale Serve Reapply/script"

cat > /etc/cron.d/tailscale-serve-reapply <<EOF
*/30 * * * * root sh -lc '$SCRIPT >> /var/log/tailscale-serve-reapply.log 2>&1'
EOF

killall -HUP crond 2>/dev/null || true

# verify
grep -n tailscale-serve-reapply /etc/cron.d/*

Persist across reboot (append to /boot/config/go):

cp /boot/config/go /boot/config/go.bak   # backup once

cat >> /boot/config/go <<'BOOTBLOCK'
# re-add Tailscale Serve cron at boot
cat > /etc/cron.d/tailscale-serve-reapply <<'EOF'
*/30 * * * * root sh -lc '/boot/config/plugins/user.scripts/scripts/Tailscale Serve Reapply/script >> /var/log/tailscale-serve-reapply.log 2>&1'
EOF
killall -HUP crond 2>/dev/null || true
BOOTBLOCK

To remove later:

rm -f /etc/cron.d/tailscale-serve-reapply
killall -HUP crond 2>/dev/null || true
cp /boot/config/go.bak /boot/config/go   # if you want to roll back the go edit

What we tried before posting

  • Verified cron is running and /boot is writable.

  • Confirmed the script runs and logs when executed manually.

  • Confirmed no cron entries are created by the plugin after clicking Apply.

  • Renamed any “cursed” script names (removed ! and parentheses) and retried Apply. Still no cron entry.


Request to maintainers

  • Please advise on known issues where Apply does not write schedules (e.g., CSRF token failures, UI state desync).

  • If there’s a canonical location the plugin writes cron (system vs user crontab), please document it.

  • If certain script names can block scheduler generation, can the UI enforce allowed characters or warn?

Happy to provide diagnostics or specific logs (syslog around Apply time, plugin PHP logs) if needed.

Hi all,

in Unraid 7.2 i cannot see anymore the "log" of the script until this is completed.

It will just show an empty blank page without the status of the script.image.png
I

First of all; many thanks for this great plugin!

It seems that there also is a new bug on unRAID 7.2 where the "schedule" field gets truncated and not visible anymore. This happens when I view the plugin/User scripts from my iPad Pro 11inch and also my iPhone 14 Plus.

Actually, when opening the user scripts page through a mobile device it looks normal in about 1 second before the schedule-field gets truncated.

When viewed on a PC everything looks normal.

In Unraid Display Settings I use the boxed view. Not sure if that affects this or not.

See this sceenshot from my iPad:

IMG_0394.jpeg

Edited by menkromsen

  • Author
On 10/31/2025 at 5:38 AM, menkromsen said:

First of all; many thanks for this great plugin!

It seems that there also is a new bug on unRAID 7.2 where the "schedule" field gets truncated and not visible anymore. This happens when I view the plugin/User scripts from my iPad Pro 11inch and also my iPhone 14 Plus.

Actually, when opening the user scripts page through a mobile device it looks normal in about 1 second before the schedule-field gets truncated.

When viewed on a PC everything looks normal.

In Unraid Display Settings I use the boxed view. Not sure if that affects this or not.

See this sceenshot from my iPad:

IMG_0394.jpeg

You should install user scripts enhanced, Much better UI, and looks to be responsive

3 hours ago, Squid said:

You should install user scripts enhanced, Much better UI, and looks to be responsive

User scripts enhanced is not usable in mobile

Screenshot_20251106-061045.png

On 10/31/2025 at 2:35 AM, Yusseiin said:

Hi all,

in Unraid 7.2 i cannot see anymore the "log" of the script until this is completed.

It will just show an empty blank page without the status of the script.image.png
I

Im still on 7.1.2 and same happens here...

2 hours ago, tooviral said:

Im still on 7.1.2 and same happens here...

For me it was working on 7.1.*. Are you using an AdBlocker or Brave? It was not working on Brave.

works fine by direct ip.

Doesn't work when I use a fqdn locally with swag reverse proxy, ie (unraid.fqdn.com)

I can confirm that. Direct access via the IP works, but I don't get any log output when accessing it through my Reverse Proxy. I do not have an ad blocker active. The log download also works via the Reverse Proxy.

Edited by tasch

Also getting a 502 Bad Gateway

Connecting via direct IP

Screenshot 2025-11-18 152407.png

  • 2 weeks later...

Hi all,

first of all - thanks for the plugin, I find it very useful. Donation is on it's way. 👍

I ran into (self caused) trouble with a script that runs every minute. Due to some unforeseen circumstances it started to produce loads of output, which filled up the root file system over three weeks.

To prevent this, I added a generic code-block after my script implementation, which rotates the log (in a very simplistic way).

As it seems to be working all right, I thought that I might just as well share it.

#!/bin/bash

# Here goes whatever you script does - replace the echo with your code block
echo "Hello world! Given enough time and frequent execution of this dummy script, it will eventually fill the root file-system."
# End of your script

# ------------------ LOG ROTATION BLOCK ----------------- 

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
LOG_FILE="$SCRIPT_DIR/log.txt"
# Change the 2000000 in the next line to an appropriate size - 2000000 is roughly 2MB
if [ -n "$(find "$LOG_FILE" -prune -size +2000000c)" ]; then
    echo -e "\n**** Rotating ${LOG_FILE}. *****" 
    echo -e "**** If you are monitoring the log, please re-start monitoring the new log. ****\n\n"
    mv "$LOG_FILE" "${LOG_FILE}_0"
fi

# -------------- END OF LOG ROTATION BLOCK -------------- 

All the best and have a nice weekend

Andreas

Hi all,

I apologize if this has been answered before.

I've recently added some cleanup code to some of my scripts allowing me to roll back stuff in case a script gets interrupted, say when closing the
script window when the script is running in the foreground. What I've discovered is that since implementing this, those scripts no longer appear to

be working when executed in the background/scheduled.
Is this a known issue? Is there a way to fix this or is trapping signals just not supported in this scenario?

Best
Matthias

Hello, I have been working on some scripts, and I thought I would share them here since some scripts were not working on my own setup, so I made generic scripts that are simple and easy to use.

- No APM for WD Blue drives.
- Scrub for ALL cache pools and notification.

Github Repo

  • 4 weeks later...

Issue with latest version 2025.12.24 after update
Issue
- After update User Script page is blank with only default options, script list and custom folders missing
Cause
- missing user.scripts.enhanced.cfg in config/plugins/user.scripts.enhanced
Solution
- Go to Settings -> User Scripts Enhanced and update and apply to restore missing file, everything should be as it was as the config.json file is retained in the plugin folder after update




Edited by 808mp5

4 hours ago, 808mp5 said:

Issue with latest version 2025.12.24 after update
Issue
- After update User Script page is blank with only default options, script list and custom folders missing
Cause
- missing user.scripts.enhanced.cfg in config/plugins/user.scripts.enhanced
Solution
- Go to Settings -> User Scripts Enhanced and update and apply to restore missing file, everything should be as it was as the config.json file is retained in the plugin folder after update




Thank you was freaking out for a seconde

On 12/24/2025 at 11:07 PM, 808mp5 said:

Issue with latest version 2025.12.24 after update
Issue
- After update User Script page is blank with only default options, script list and custom folders missing
Cause
- missing user.scripts.enhanced.cfg in config/plugins/user.scripts.enhanced
Solution
- Go to Settings -> User Scripts Enhanced and update and apply to restore missing file, everything should be as it was as the config.json file is retained in the plugin folder after update




and if you have no update for user.scripts.enhanced? how to fix this issue? ... im not sure if maybe i had already updated and still the problem persists, or if i just dont have an update... but either way i dont have the option to update and so my user.scripts page is just completely blank? how to fix?

Edited by clenga

Thanks for the reports of the issue in the 2025.12.24 Update of USE
@808mp5 And special thanks for showing me the reason for the issue.

The issue was simple: the CSS field was NULL if the config file didn’t exist. Since the servers I used for development already had this file, I didn’t encounter the bug during development.

Btw: Correct thread for the Bug Reports of USE would be:
https://forums.unraid.net/topic/191294-plugin-user-scripts-enhanced

  • 2 weeks later...

I am also experiencing the same bug causing cron jobs to not work whatsoever as @OsoPolar mentioned above.

Is there any planned fix coming for this? I'm running the latest version 2025.06.21.

  • 3 weeks later...

Would it be possible for the plugin to call /usr/local/emhttp/webGui/scripts/notify if a user script returns a non-zero exit code passing something like "User Script Failed" as the subject and the filename of the script as the message? It could be optional (i.e. a feature that can be enabled or disabled) and disabled by default if there are any concerns that it would disrupt existing plugin users. Right now I am adding calls to notify within many of my scripts so that I am alerted if they fail -- they would be much less redundant if the plugin executing script handled error notifications.

  • 1 month later...

Inline variables described under "HOW TO ADD SCRIPTS" do not work:

#!/bin/bash

#noParity=true

#clearLog=true

################################################################################

# Script: borg_backup_appdata_usb.sh

# Version: 1.0.0

# Last Updated: 2026-02-25

#

# Changelog:

# v1.0.0 (2026-02-25) - Initial version

################################################################################

The script is started even when a parity check is running.

No output in the scipt window, no echos are visible:

2026-02-26 14_17_32-Greenshot.jpg

  • 1 month later...

I have a suggestion. Can you add a column to the right of each script that plainly translates the cron schedule? For example:
0 22 * * 1-5 --> At 22:00 on every day-of-week from Monday through Friday.

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...

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.