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

  • Author
9 hours ago, skunkworker said:

I'm running into a strange issue. When editing a script and then clicking "run in background" the newly edited script does not get run, but the older revision does. It took me touching the file in /tmp in order to get the script updated.

Gimme a day or so  I'll check it out

  • 4 weeks later...
  • Replies 2.1k
  • Views 567.2k
  • 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

basic question - if I have a custom cron schedule and a task is still running from the last execution (e.g. backup job), will the script get run again or only if it's not already running?

 

Thanks

  • Author
4 hours ago, DZMM said:

basic question - if I have a custom cron schedule and a task is still running from the last execution (e.g. backup job), will the script get run again or only if it's not already running?

 

Thanks

It'll run a second instance.  To have it avoid that, your script needs to check if its already running

 

In pseudocode:

if tempFile exists then exit
create tempFile
the actual script here
remove tempFile

 

26 minutes ago, Squid said:

It'll run a second instance.  To have it avoid that, your script needs to check if its already running

 

In pseudocode:


if tempFile exists then exit
create tempFile
the actual script here
remove tempFile

 

Very simple but effective - thank you. 

  • 2 weeks later...

I'm having an issue with user scripts where when I have a script set to run in the background and then abort it, it stays running. This is my script:

 

#!/bin/bash
#----------------------------------------------------------------------------
# This script mounts your remote share with the recommended options.         |
# Just define the remote you wish to mount as well as the local mountpoint.  |
# The script will create a folder at the mountpoint                          |
#----------------------------------------------------------------------------

# Local mountpoint
mntpoint="/mnt/disks/cloud" # It's recommended to mount your remote share in /mnt/disks/subfolder - 
                                # This is the only way to make it accesible to dockers

# Remote share
remoteshare="cache:" 	# If you want to share the root of your remote share you have to 
                                # define it as "remote:" eg. "acd:" or "gdrive:" 

home="/mnt/user/appdata/rclone"
tmpupload="$home/tmp"
#---------------------------------------------------------------------------------------------------------------------


mkdir -p $mntpoint
mkdir -p $tmpupload

rclone --allow-non-empty --allow-other mount $remoteshare $mntpoint --cache-db-path=$home --cache-tmp-upload-path=$tmpupload --cache-tmp-wait-time=30m -vv

And after "aborting" the script using the userscripts button this is what `ps auxw |grep rclone` says on the system:

 

root      3230  0.0  0.0   9812  2044 pts/0    S+   13:48   0:00 grep rclone
root     27063  0.0  0.0  11956  2908 ?        SN   12:48   0:00 /bin/bash /tmp/user.scripts/tmpScripts/rclone_mount_plugin/script
root     27066  0.0  0.0  11960  2908 ?        SN   12:48   0:00 /bin/bash /usr/sbin/rclone --allow-non-empty --allow-other mount cache: /mnt/disks/cloud --cache-db-path=/mnt/user/appdata/rclone --cache-tmp-upload-path=/mnt/user/appdata/rclone/tmp --cache-tmp-wait-time=30m -vv
root     27068  0.8  0.2 155556 66464 ?        SNl  12:48   0:31 rcloneorig --config /boot/config/plugins/rclone/.rclone.conf --allow-non-empty --allow-other mount cache: /mnt/disks/cloud --cache-db-path=/mnt/user/appdata/rclone --cache-tmp-upload-path=/mnt/user/appdata/rclone/tmp --cache-tmp-wait-time=30m -vv

This same behavior is apparent in my plexdrive backgrounded script also. After aborting it still stays running.

 

Am I doing something wrong here?

  • Author

Any long running commands do not get aborted. You want the user script to start the "real" script in the background by doing something like

echo "pathToScrip" | at NOW -m

Sent via Tapatalk because I'm either at work or enjoying the summer

Ok, so I should fire off the mount with a subscript. And I suppose use a different script with a "killall rclone" or something like that?

 

Not as elegant as I was hoping for but as long as I can make it work it's fine.

 

I am curious to know why the abort button doesn't actually abort the script. It doesn't seem like it's very useful. If you set a script to "run in the background" it seems reasonable to assume the abort button will cancel that script. Right now it seems like it does nothing.

I had to fresh install unraid.. after installing user scripts it seems like the icon is missing.. anyone else experiencing this issue?

 

image.png.1b60bba34341dc02d2a2eff6e25e3560.png

  • Author
1 hour ago, endiz said:

I had to fresh install unraid.. after installing user scripts it seems like the icon is missing.. anyone else experiencing this issue?

 

image.png.1b60bba34341dc02d2a2eff6e25e3560.png

IDK  Looks like something went wrong for some reason on install.  I just did a fresh one and there's no problem with the icon

Hi guys, i need some help. I am trying to run custom cron of my scrub scripts, but recieve this:

 

unRaid crond[1825]: exit status 127 from user root * /usr/local/emhttp/plugins/user.scripts/startCustom.php /boot/config/plugins/user.scripts/scripts/Scrubc/script > /dev/null 2>&1

 

my script is: (\config\plugins\user.scripts\scripts\Scrubc\script)

#!/bin/bash
/usr/local/emhttp/plugins/dynamix/scripts/notify -e "start_scrub_cache" -s "Scrub cache drive" -d "Scrub of cache drive started" -i "normal" -m "Scrubbing message"
btrfs scrub start -rdB /mnt/cache > /boot/logs/scrub_cache.log
if [ $? -eq 0 ]
then
   /usr/local/emhttp/plugins/dynamix/scripts/notify -e "start_scrub_cache" -s "Scrub cache drive" -d "Scrub of cache drive finished" -i "normal" -m /boot/logs/scrub_cache.log
else
   /usr/local/emhttp/plugins/dynamix/scripts/notify -e "start_scrub_cache" -s "Scrub cache drive" -d "Error in scrub of cache drive !" -i "alert" -m /boot/logs/scrub_cache.log
fi

cron-custom.jpg.c5b1f916ee45fb40636e32e608850e00.jpg

 

Run/Run in Background works fine. Custom cron - dont.

That screenshot suggests you have 6 fields in the custom entry.    On my system I only use 5 fields and custom cron jobs run fine.   Not sure if this matters but thought it worth mentioning.

Edited by itimpi

10 hours ago, itimpi said:

you have 6 fields in the custom entry

 

Thank you so much for watching, man.
I fixed it to 5 fields, I'll see how it works, I'll write it helped or not ?
I'm almost sure that the reason for this

 

P.S. Thanks, @itimpi , Problem solved! 

Edited by vanes

  • 2 weeks later...

Thank you for this plugin!  Is there a way to access a "Run Script" button via a URL?  Would love to add links on our phones that we can trigger with a single press rather than opening a browser, going to the user scripts page and then pressing one.

I've added a /scripts pointing to  /boot/config/plugins/user.scripts/scripts/ in radarr and sonarr to run a couple of my scripts.   Do I need to do anything funky like RO/Slave etc, or just leave it as Read/Write?

 

Thanks

  • Author

Nope.  /boot isn't an unassigned device, so you can just leave it at RW.  Not that RW:Slave causes any problems though.

41 minutes ago, Squid said:

Nope.  /boot isn't an unassigned device, so you can just leave it at RW.  Not that RW:Slave causes any problems though.

Thanks

Hi,

 

I need to use expect for SSH connection, but it is not installed on unRAID by default.

 

I am trying similar code like this:

#!/usr/bin/expect -f
spawn ssh [email protected] "ls /file"
expect "password:"
send "mypassword\r"

 

Do anyone have any idea how can I install expect to unRAID?

 

Thanks,

Mark

1 hour ago, MasterMark said:

Do anyone have any idea how can I install expect to unRAID?

 

Expect is included in nerd tools.

11 hours ago, wgstarks said:

Expect is included in nerd tools.

 

Oh, I totally forgot nerd tools. Thanks a lot. 

  • 2 weeks later...

hopefully a simple request for you linuxy experts.

I have the rclone custom script running to send CCTV footage of alerts to my gdrive.

The script runs minimum 1 hour in user scripts - in which time the thief may have found my unraid system and nicked it too....

The 'custom' allows for a cron type input.  What can I put in there for every 5 minutes ?

3 hours ago, vw-kombi said:

hopefully a simple request for you linuxy experts.

I have the rclone custom script running to send CCTV footage of alerts to my gdrive.

The script runs minimum 1 hour in user scripts - in which time the thief may have found my unraid system and nicked it too....

The 'custom' allows for a cron type input.  What can I put in there for every 5 minutes ?

 

*/5 * * * *

 

 

I installed a new usb drive, bc the old was failing from time to time.

 

I have CA Backup thingy. (but i cant find my scripts, only the preinstaleld scriptps got backed up ? )

 

Yesterday i set everything up, urrently i let a parity run. I thought all is fine, but  sadly all my custom scripts are lost... how to backup them?

Edited by nuhll

You can download a complete zipped backup of your flash drive at Main - Boot Device - Flash - Flash backup

  • Author
11 hours ago, nuhll said:

I have CA Backup thingy. (but i cant find my scripts, only the preinstaleld scriptps got backed up ? )

 

They would all be in the destination you set for USB backup... config/plugins/user.scripts/scripts

I dont know why, but there are only the standard scripts...

 

or... does it have a bug and cant backup ö ä ü ß ?

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.