[Plugin] CA User Scripts


1233 posts in this topic Last Reply

Recommended Posts

1 hour ago, Alex.b said:

/mnt/user/disk2/Nextcloud_backup

Are you sure this is the actual path? That is a user share named disk2. I recommend not having a user share named the same as a disk. It will only lead to confusion.

 

If this is indeed the correct path, maybe it was not what you had in mind. What did you have in mind?

Link to post
  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Just a simple little plugin to act as a front end for any little scripts that you may have that you may need to run every once in a while, and don't feel like dropping down to the command line to do i

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

@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

Found a weird little bug that made for some interesting troubleshooting.

 

I created a script with an exclamation point at the start.  User scripts did not like this.  Started throwing errors in the console.  wouldn't allow me to delete so I removed from console.

 

Lesson learnt, don't start scripts with a ! 

Link to post

I have a problem where whenever an rsync script is ran via user scripts,

Quote

rsync -avu --chown=nobody:users --chmod=Du=rwx,Dgo=rwx,Fu=rw,Fog=rw --delete --stats --exclude=/cache/ -e "ssh -i /root/.ssh/NAS-rsync-key -T -o Compression=no -x" "myusername@1.1.1.10:/var/www/html" "/mnt/user/Backup/test" >> /home/nasbackuplogs/logs/$(date +"%Y%m%d")-test-backup.log

When i test running this in the CLI it works fine, it sets both directories and files that are being backed up to the correct permissions for unraid, but whenever the same command runs via user scripts it for whatever reason sets the directory permissions to drwxrwx--- instead of drwxrwxrwx+, please advise?

Link to post
1 hour ago, je82 said:

I have a problem where whenever an rsync script is ran via user scripts,

When i test running this in the CLI it works fine, it sets both directories and files that are being backed up to the correct permissions for unraid, but whenever the same command runs via user scripts it for whatever reason sets the directory permissions to drwxrwx--- instead of drwxrwxrwx+, please advise?

Try adding the following to the beginning of your command so it runs in a login shell:

sudo -i -u root 

 

Link to post

Hi

 

Love this plugin, have one issue, where only the first entry get the three icons (Log file, Download Log, and Delete Log)

Ive inspected the dom, and the icons are there for the other lines, but display:none is applied

 

Does any one know why, or is this a bug?

 

Thanks

 

Added to CA:March 30, 2018

Date Updated:August 21, 2020

Current Version:2020.08.22

 

 

Link to post
4 minutes ago, Matt_UK said:

Hi

 

Love this plugin, have one issue, where only the first entry get the three icons (Log file, Download Log, and Delete Log)

Ive inspected the dom, and the icons are there for the other lines, but display:none is applied

 

Does any one know why, or is this a bug?

 

Thanks

 

Added to CA:March 30, 2018

Date Updated:August 21, 2020

Current Version:2020.08.22

 

 

Until the script actually HAS a log file, the buttons are hidden. Or are you saying the scripts seem to be running on schedule, but still no buttons?

Link to post
On 9/21/2020 at 5:29 PM, Alex.b said:

How can I access to /tmp/user.scripts/ to view full logs ?

 

open unraid terminal (or ssh, etc) and use the "cd" command like so:

cd /tmp/user/scripts/tmpScripts/xxx/

 

be sure to use capitals when necessary. If the script log is short, you can use the "cat" command to view directly in terminal window like so:

cat /tmp/user.scripts/tmpScripts/xxx/xxx.txt

(or if you used the "cd" command to navigate to the directory already, use:)

cat xxx.txt

 

If the log is too long to view its contents entirely in the terminal, you can copy the log to an easier to access location, such as a folder on the array, and open with a notepad app to view the whole log, like so:

cp /tmp/user.scripts/tmpScripts/xxx/xxx.txt /insert/destination/path/here

 

hope this helps

Link to post
On 9/17/2020 at 4:55 AM, cmarshall85 said:

 

@Derek_ did you ever figure this out? I am having the same issue. When I run lftp, any folders/files it creates are root:root and i need it to be nobody:users. Thanks!

Hiya, sorry it's taken so long to reply. No - i never figured it out. I just accepted it as it was. As someone mentions, you can chown it after operations are complete if that works for your scenario.

Link to post

Eum, where are the script output logs stored? after execution(of all scripts) I get the trashcan to delete log icon/prompt to delete log of task name, not informing path of log.

How to view them?

No idea where it would be. at flash /logs it shows none.

 

Edit: OK, they can be found at /tmp/user.scripts/tmpScripts/

 

# logfile log.txt

Edited by 54tgedrg45
Link to post
2 hours ago, 54tgedrg45 said:

Eum, where are the script output logs stored?

There aren't any. The logs are buggy so I used this at the beginning of all my scripts:

# logging
exec > >(tee --append --ignore-interrupts $(dirname ${0})/log.txt) 2>&1

By that all output is twice in the logs, but this was the only solution that worked.

 

And only to inform you. There is another bug. Its not possible to stop scripts although the dashboard claims it. It seems @Squiddid not found the time to correct it. I posted two ways to solve it.

 

Link to post

User scripts has grown from a quickly bolted together handy but buggy tool into a substantial part of unraid that a lot of users have use for, and it needs and deserves a lot of rework and refactoring and attention to take it to a higher level. 

Edited by jowi
Link to post

Yes, if i had the expertise. I can do c# .net core etc programming and some minor python, but somehow i think that is not needed here. Also linux is not my thing.

 

If you’re suggesting i am not allowed to comment unless i contribute? F*** you. That is not up to you.

Edited by jowi
Link to post
5 hours ago, mgutt said:

The logs are buggy

The logs are everything that is output by the script. And there's a download button that grabs them.

 

Other things

 

This is going to come across as a bit bitchy, but I truly don't mean anything by it.

 

This plugin was simply designed to run a quick and dirty script here and there.  It has definitely morphed into something else.  And yes there are issues with

  • Certain script naming will crash the plugin
  • Sub processes spawned off of the initial script have issues being stopped

 

Priorities are everything.  While I do understand and appreciate the comments and suggestions, time doesn't always play along with supporting of code changes (or as probably needed here a complete rewrite of the plugin - which isn't an inconsequential time investment) and/or fixes.

 

My priorities are as follows:

 

  1. CA, application feed, related items.  They trump everything else
  2. Actual real-world work
  3. Fix Common Problems (Any false positives that may pop up as new versions of Unraid are released)
  4. Unraid GUI bug fixes etc
  5. Alexander Keith's
  6. Dogs
  7. Sleep
  8. Family
  9. Doom

(Hopefully the wife doesn't read this ;), but that order does keep me sane)

 

So far as time permitting after all of that, the priorities that I see plugin related (time permitting) are

 

  1. Autoupdate.  I've noticed some oddities that I'm not sure if its a bug or not and need to investigate
  2. Backup / Restore - restart order doesn't match what's been utilized in the docker tab
  3. Cleanup Appdata - needs a big revamp to make it functionally work without probable timeouts happening if/when the deletions take more than 120 seconds
  4. Backup / Restore - Longstanding req to separate the archives by folder, and selectively restore them

This plugin lags behind because it still is 100% functional within its original design considerations.  Problem with it is that the code is ancient, and a rewrite is basically required to bring it into line with everything else, and make it maintainable.

 

Unfortunately due to priority #2, my time is extremely limited until Christmas, and what time I do have may be filled up with priority #5 when the situation may change.

 

I will get to it.  I, like everyone else around here am a volunteer.  In the meantime if anyone has any PRs, then they will get merged after testing.

 

 

 

 

Link to post
3 hours ago, Squid said:

The logs are everything that is output by the script. And there's a download button that grabs them.

 

No. Does not work. echo "bla" is not logged. No verbose output is logged. Only fatal errors are logged. This is the reason why so many people complain and ask for the "real download" ;)

Link to post

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.