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

1 hour ago, jmbailey2000 said:

 

crontab.guru is an online page that I use. Let's me put stuff in and shows you the result. Also has a huge page of examples of almost every type.

Yes, I've used a couple of different ones, but like I say - the reference on the plugin page is useful as it shows the format that it specifically accepts.

  • Replies 2.1k
  • Views 567.6k
  • 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

hello,

 

I'm noob to use a script...

Can I run this example

docker exec -it nextcloud sudo -u abc php7 /config/www/nextcloud/occ files:scan --all

 

Edited by thymon

  • Author

You definitely want to get rid of the -i as that means interactive

6 hours ago, Squid said:

You definitely want to get rid of the -i as that means interactive

nice ! 
Thanks 😊 

  • 2 weeks later...

I'm new to this and I'm hoping I can use this plugin to call the radarr V3 API. Specifically the /command endpoint ImportListSyncCommand. Is this possible? Where would I start?

48 minutes ago, MajorTomG said:

I'm new to this and I'm hoping I can use this plugin to call the radarr V3 API. Specifically the /command endpoint ImportListSyncCommand. Is this possible? Where would I start?

See a few posts above for another example of running a command inside a docker.

How do I run any CA Userscript Script from within a Terminal Session?

  1. I know copies of scripts are held and ran from " /tmp/user.scripts/tmpScripts"....but when I go there via Terminal...I don't see ALL of my scripts listed (only a subset). It appears the only scripts listed here are ones which have been previously executed through Userscripts GUI.
  2. I know scripts are also located in "/boot/config/plugins/user.scripts/scripts" but those are all buttoned up with permissions restricting run (probably for good reason too since its the flash drive).

I'm trying to host a discord bot I made in python using the discordpy library, and I wanted to have the script ran every hour. however I'm not to experienced with bash so i'm a little stuck on running the script.

 

this is the code I tried and I have installed the nerdpack plugin and enabled python3 in the settings. I have also rebooted my server after installing/enabling

 #!/bin/bash
cd /mnt/user/scripts/Predicting_Alpha_Bot
python bot.py

 

When I run the script using the user script plugin it shows an error saying unknown command 'python'. I'm not sure if I have to specify the python path or anything so any help would be greatly appreciated!

7 minutes ago, zaymus said:

specify the python path

Try it

24 minutes ago, trurl said:

Try it

I'm new to unraid and not very experienced in bash so I'm not really sure how to try it or find the python path

[BUG] German Umlauts [äöüÄÖÜß] disappear during save

 

I do have some scripts that do require German Umlauts (see above). I can put them into the big edit field but they disappear after saving the user script.

 

 

For example: Within a user script I do call a python script to export data. I enter something like that (shortened):

python3 [path]/ExportData.py -l Hörbücher

 

After saving and reopening the script this is what became stored:

python3 [path]/ExportData.py -l Hrbcher

 

Thanks.

 

  • Author

Yeah, it's not a bug, but by design.  Trouble is that there were so many users copying / pasting scripts from the forums here and doing that introduces other unwanted characters into the script, that all non pure ASCII characters were removed.  I'll revisit next week.

I have a python script that is being ran by the user script plug in however i'm using a package that is not native to python so I was wondering how I would install it on my server so that it can be used by my script. I tried pip installing it through the command line but got some errors so im wondering if there is another way. 

 

I have the error message in this file if needed. install error message.txt

 

 

Edited by zaymus
added file

On 12/9/2020 at 2:48 PM, Squid said:

Yeah, it's not a bug, but by design.  Trouble is that there were so many users copying / pasting scripts from the forums here and doing that introduces other unwanted characters into the script, that all non pure ASCII characters were removed.  I'll revisit next week.

Thanks in advance.

 

IMHO: Don't modify user content in an entryfield automatically. It becomes a can of worms to decide and filter what's unwanted and what's intended. If you need to, check for unwanted characters and simply popup a small dialog "Non-ASCII characters detected. Are you sure?" and let the user decide.

 

  • Author

I reverted it.  (It was originally put in in 2017)

On 12/9/2020 at 11:36 AM, zaymus said:

I have a python script that is being ran by the user script plug in however i'm using a package that is not native to python so I was wondering how I would install it on my server so that it can be used by my script. I tried pip installing it through the command line but got some errors so im wondering if there is another way. 

 

I have the error message in this file if needed. install error message.txt

 

My suggestion is to build a docker image (using one of the official python base images), include your python script (run it from the entrypoint) and all of its dependencies. Then run the container from your user script. 

Im having a bit of an issue where aborting a script doesn't actually kill it. Is there a workaround so I don't have to manually hunt down and kill all the process every time. 
Thanks

Hi all,

 

Sorry for the dumb question but:

 

I want to execute a script created with the "CA User Scripts" plugin not from the Unraid GUI but from the terminal (or from another script for that matter). What is the simplest way to do so?

 

I indeed noticed that the "/tmp/user.scripts/tmpScripts" directory only contains scripts which were previously run from the Unraid GUI, and that in the "/boot/config/plugins/user.scripts/scripts" directory, the scripts permissions are set to 600 which make them not executable.

 

Many thanks,

Best

OP

  • Author
14 minutes ago, Opawesome said:

in the "/boot/config/plugins/user.scripts/scripts" directory, the scripts permissions are set to 600 which make them not executable.

Security precaution in Unraid.

 

use this

/bin/bash /boot/config/plugins/user.scripts/scripts/.....

 

28 minutes ago, Squid said:

Security precaution in Unraid.

 

use this


/bin/bash /boot/config/plugins/user.scripts/scripts/.....

 

Dear Mr. @Squid.,

Awesome. You always come with such simple and elegant solutions :) .

Thank you very much.

Best regards,

OP

I am looking for a script that would monitor a TCP port and accept commands to spinup, spindown, or return status of a disk. The the minimum capability I need would be a command to spin up all the disks in the array.  I could have them spin down after 4 hours of inactivity.  The major use of the array is to feed my own home theater movie system. The delay when loading a movie bothers me and I would like to spin up the the array disks when I open the theater's movie librarian. 

 

It is my belief that if disks are generally not being used keeping them in a spun down state will increase their longevity

 

Any help or advice would be greatly appreciated. 

Hello all,

 

Thought I would post my experience here since my search-fu didn't come up with an answer, and someone else may have the same issue.

 

I wanted to create a simple script to reboot my server once a week. My script worked when manually executed (RUN SCRIPT). However I was unable to make any schedule stick. I noticed that when hovering over the cog for pre-installed docker restart $(docker ps -q) no options appeared. The contents /boot/config/plugins/user.scripts/scripts contained the directory:

 

docker\ restart\ $docker\ ps\ -q/

 

I renamed this directory to docker_restart and refreshed the User Scripts page and now hovering over cog displays options and I can apply a schedule to my new script.

 

Cheers

  • Author

Don't name the script (as you did) using special characters

1 minute ago, Squid said:

Don't name the script (as you did) using special characters

That one isn't mine. It was one of the ones created when I installed the plugin

  • Author

image.png.f3d5931e36b658e852d078ee67f18510.png

 

These are the only 3 that have ever come with the plugin.  You've added it at some point.  Removing and reinstalling the plugin doesn't ever clean up any other existing scripts

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.