[Plugin] CA User Scripts


Recommended Posts

Hi can I get some help with what is probably an easy fix please.  

 

I've started using this python utility https://github.com/adamgot/python-plexlibrary where I've saved the files to /mnt/user/appdata/other/python-plexlibrary-master.  When I run the python utility via command line from the folder e.g.

 

python plexlibrary movies_recommended

everything works fine, but when I try to do via script e.g:

 

#!/bin/bash

cd /mnt/user/appdata/other/python-plexlibrary-master 

python plexlibrary movies_recommended

exit

I get this error:

 

Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/mnt/user/appdata/other/python-plexlibrary-master/plexlibrary/__main__.py", line 3, in
main()
File "plexlibrary/plexlibrary.py", line 61, in main
r.run(args.sort_only)
File "plexlibrary/recipe.py", line 696, in run
missing_items, list_count = self._run()
File "plexlibrary/recipe.py", line 172, in _run
matching_total, item['title'], item['year']))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 23: ordinal not in range(128)

I've also tried:

 

#!/usr/bin/env python

cd /mnt/user/appdata/other/python-plexlibrary-master

plexlibrary movies_recommended
plexlibrary movies_imdb_top_250

exit

Help please

Help please

Link to comment
3 minutes ago, Julius said:

Does the 'At startup of Array' run before or after the go script?

 

Way, way after.  When the array is actually started.

 

3 minutes ago, Julius said:

Does the 'At startup of Array' execute before or after ssh service daemon starts?

 

I would think after

Link to comment
2 hours ago, itimpi said:

Use the 'go' file for commands you want run as part of the Unraid boot process and a 'stop' file for commands to be run when the system is shutting down.   The User Scripts plugin is for scripts to be used during normal Unraid operation.

Is the 'stop' file supposed to be in the '/boot/config/' also?

Link to comment
1 hour ago, itimpi said:

Yes.  It goes in the same location as the ‘go’ file.  I am not sure why Limetech do not provide a dummy file as part of the standard release.

You learn something new every day - didn't know about a stop file.  In an ideal world there'd also be something like go_user and stop_user files that are called from go and stop where all custom config would go, leaving the core files stock and safe to update.

  • Like 1
Link to comment
19 hours ago, bonienl said:

haha, not as undocumented as I thought 😄

🙂 I've also been using the /extra folder for quite some time. It saves me from having to install the nerdpack plugins, since I can just cherry pick the few packages I need (perl, pigz, ipmi tool, etc...). As well, I can pull from public repo's and update them when I want to, instead of having to bother a dev in here to update a package.

 

 

stop file is new though! At what part in the shutdown sequence does it run, prior to stopping the array, or after all processes have been stopped right before power off?

Edited by cybrnook
Link to comment

Thanks @itimpi , I have played in SLES in the past using the halt.local and after.local functionality. However, on shutdown (halt.local), I always ran into that timing issue of where in the shutdown process it executed and it was always later in the shutdown sequence than would have ever done me any good, which is why I asked.  Ended up just creating some daemon processes that a clean shutdown would tackle.

 

NOTE: Not that there is any issues I have today during shutdown that Unraid is not already taking care of for me.

Edited by cybrnook
Link to comment
  • 2 weeks later...

So I build my own Daily, Weekly, Hourly scripts?

 

Ah, I see. Thought User Scripts would work that way. Will do it.

 

NowI do understand why my M.2 NVMs report high temperatures in the night. No good idea to start approx. six daily scripts at once.

 

Thanks.

 

 

Edited by hawihoney
Link to comment
22 hours ago, hawihoney said:

So I build my own Daily, Weekly, Hourly scripts?

I think it's more that you create and schedule one script, and that script calls all the others one after another.

 

Or you could apply a custom schedule to your scripts and have them run - say - 30 minutes apart.

Link to comment

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.