[Plugin] CA User Scripts


Recommended Posts

6 hours ago, theDrell said:

Everytime I install this plugin and reboot, my cache drives go offline.  After I remove this plugin and reboot, I can then add my cache drives back.  Anyone else have issues like that?

Its not the fault of the plugin.  Unless of course you are running a script that is doing something causing that.

  • Upvote 1
Link to comment
3 hours ago, Squid said:

Its not the fault of the plugin.  Unless of course you are running a script that is doing something causing that.

To the best of my knowledge, there are no scripts scheduled.  It is the first install of that plugin.  I had installed the rclone plugin beforehand, and it seems to stay with no issue, but the userscript one gives me the missing cache drives.  I just looked under the config, the only 3 scripts I see there are delete ds_store, delete dangling images, and viewDockerLogSize.

 

I am on 6.5.3 if that matters.

Edited by theDrell
Link to comment

So, restarted my server without this plugin installed.  And My cache drives disappeared again.  Not sure what is causing this, I will go search elsewhere.

 

Just found where if you use Chrome the cache drives can disappear on restart.  Sorry guys, it just correlated perfectly to this plugin install twice.

Edited by theDrell
Link to comment
17 minutes ago, trurl said:

Do you have any adblockers? You should whitelist your server.

I do, I have tried several browsers now, and even tried from the UnRaid GUI.  That is not the problem actually.  It appears that using the reboot action completely drops my cache drives and they don't even show up in the unassigned devices.  I then have to do a power down and a cold start, and then reassign them to the cache.  However a power down and then pressing the power button seems to work just fine instead of the reboot.

Link to comment
17 minutes ago, theDrell said:

I do, I have tried several browsers now, and even tried from the UnRaid GUI.  That is not the problem actually.  It appears that using the reboot action completely drops my cache drives and they don't even show up in the unassigned devices.  I then have to do a power down and a cold start, and then reassign them to the cache.  However a power down and then pressing the power button seems to work just fine instead of the reboot.

Sounds like some sort of hardware issue where something isn't getting re-initialized on a warm start but does on a cold start.

Link to comment

So I let me start with - I love this plugin! It's fantastic for some various tasks. Recently I've been exploring some options with UPS activity and in many cases it involves running another service/daemon to just run a script. I was thinking it might be great if I could just do so from unRAID instead of setting up individual installs. 

 

Would it be possible and/or is it feasible to extend this plugin to allow for another drop-down option for the schedule to happen on power-loss or power-restore from the UPS? Assuming of course unRAID is powered on, I'd love to be able to kick off the shutdown scripts for example that I'd be sending to my ESXi boxes, my Rock64, an extraneous piece of network equipment, etc. 

Link to comment
  • 3 weeks later...
44 minutes ago, wgstarks said:

I have a bash script in a share that I want to run on a cron schedule.


/mnt/user/odin_backup/OdinBackUp/odin_backup.sh

Is there some way to use this plg to run the script?

Nevermind. I think I figured it out. This seems to be working-

cd /mnt/user/odin_backup/OdinBackUp && bash odin_backup.sh

 

Link to comment
  • 3 weeks later...

Hi

 

I am looking to do something very simple. I want a user script which restarts a docker container, lets say Transmission when run.

 

So I went to the user scripts GUI, clicked on add script and created a new script. I named it 'restart transmission' and saved. Then I went to edit and added the line 


 

restart docker transmission

and saved the file

 

So the script file now reads 


 

#!/bin/bash

docker restart transmission

 

But when I run the script nothing happens, a blank window just opens. I am able to get the desired result by issuing this command from command line however. What am I missing?

 

Link to comment
6 minutes ago, extremeaudio said:

Hi

 

I am looking to do something very simple. I want a user script which restarts a docker container, lets say Transmission when run.

 

So I went to the user scripts GUI, clicked on add script and created a new script. I named it 'restart transmission' and saved. Then I went to edit and added the line 


 


restart docker transmission

and saved the file

 

So the script file now reads 


 


#!/bin/bash

docker restart transmission

 

But when I run the script nothing happens, a blank window just opens. I am able to get the desired result by issuing this command from command line however. What am I missing?

 

 

docker stop transmission
docker start transmission

 

Link to comment
8 minutes ago, Squid said:

Is the window completely blank?  Or is there a message in there about the script location etc.

I realize the window was blank because some other user script was running. After I stopped the other running script and ran this again, I got some info in the window. So basically even the 'restart' command works. Just that I needed to wait till the other script finishes.

Edited by extremeaudio
Link to comment

Getting "cat: write error: Broken pipe" when booting unraid with this plugin installed. I have not installed any scripts yet.

I see "Fix broken pipe" in the release notes but, yeah. I still see it. ;) Don't know if it has any ill-effects.

Edited by Niklas
Link to comment

So, running 6.4.1 and the AppleDouble and DS_Store scripts run but the files are still there (even after a reboot) is there something about the scripts and spaces in the directory names (ie. - Media)?

 

My bad.. I just added a script for dot_clean files.. Didnt work though just used ._* for the "name" variable

Edited by HarshReality
Link to comment

ok i think i might just be really bad but well... i tried a lot of command to launch the preview:generate-all of the occ for nextcloud and i cant find anything working... the best i got is from that line 

sudo -u nobody php /mnt/cache/appdata/nextcloud/www/nextcloud/occ preview:generate-all -vvv

 

but then i got a connection error..... 

Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /mnt/cache/appdata/nextcloud/www/nextcloud/lib/private/DB/Connection.php:64

 

i know that nexcloud is connected to a mariadb database but i cant seems to be able to connect to it either :(

and yes i tried things like that

docker exec -it nextcloud bash 

sudo -u abc php /config/www/nextcloud/occ  preview:generate-all -vvv

(the normal command i can use when im in the console view of the docker)

 

so any hint would be nice if possible and else but still thanks caus im pretty sure that when ill find how this thing work it will be nice :P

 

 

Link to comment

Hi, 

First off, this plugin is awesome!

Hopefully this is the right place for a feature request:

I'd like to have a script run on startup/reboot of the server after Docker has finished starting up. The script starts a VM.

My workaround:

#!/bin/bash
sleep 240 && virsh start uuid-of-vm

I figure that the "At Startup Of Array" schedule in User Scripts would work; however, it is executed when the array BEGINS starting up and not when the array has COMPLETED starting up. Sure, I can increase the sleep interval to a longer time period but as the array gets larger and I add more containers/VMs, the sleep time would have to be adjusted.

TL;DR Can more schedule options be added like: "Array Startup", "Array Startup Complete", "Docker Startup", "Docker Startup Complete", "VMs Startup", "VMs Startup Complete". 

For now, is there something I can add to the script that would allow it to run after a certain docker container has (or all docker containers have) started?

Thanks!

Link to comment

Every 20 minutes syslog records the following error:

 

Oct 30 11:23:01 MediaNAS crond[1943]: failed parsing crontab for user root: #015
Oct 30 11:43:02 MediaNAS crond[1943]: failed parsing crontab for user root: #015
Oct 30 12:04:01 MediaNAS crond[1943]: failed parsing crontab for user root: #015
Oct 30 12:24:01 MediaNAS crond[1943]: failed parsing crontab for user root: #015
Oct 30 12:44:02 MediaNAS crond[1943]: failed parsing crontab for user root: #015

 

This all started with a script I created in User Scripts which I ended up deleting.  However, deleting it from User Scripts did not clean up the problem (It used to show the name of the deleted script in the error).  I tried to do some manual cleanup in custom.Schedule.cron and schedule.json to remove all references to the deleted script, but, something, somewhere is still referencing a script that no longer exists and is producing this error, although no longer by name.

 

Any ideas where to look?

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.