[Plugin] CA User Scripts


Recommended Posts

Personally I would try CA docker autostart manager and delay the start of those apps to see what happens first.

 

But if that doesn't work I would try this as a script running at startup.

 

sleep 300
docker stop emby
sleep 60
docker start emby

 

Sent from my SM-T560NU using Tapatalk

 

Thanks a lot. Didn't know about this plugin but it seems to be exactly what I've searched for. 8)

 

Link to comment

Personally I would try CA docker autostart manager and delay the start of those apps to see what happens first.

 

But if that doesn't work I would try this as a script running at startup.

 

sleep 300
docker stop emby
sleep 60
docker start emby

 

Sent from my SM-T560NU using Tapatalk

 

Thanks a lot. Didn't know about this plugin but it seems to be exactly what I've searched for. 8)

I would think the autostart manager is simpler as it sounds like some sort of race condition and you just need to delay it.  But it's 6.3 only

 

Sent from my LG-D852 using Tapatalk

 

 

Link to comment
  • 3 weeks later...

I've installed CA User Scripts and understand that there are supposed to be some default scripts that come pre-installed. In my installation, there aren't any.

 

/config/plugins/user.scripts/scripts exists, but has nothing in it.

 

Am I missing something? (Both personally, and on the flash drive?!)

Because somehow back in November I missed putting the sample scripts in the installation archive, and no one has noticed until you.

 

Today's update has it back in, but the way that the system works is that if /config/plugins/user.scripts/scripts already exists, then it won't copy them into it.

 

You have to delete that folder and then update.  A remove / reinstall won't work either because I purposely don't delete the folders on the flash so that any user scripts contained within are still preserved.  (But a remove / delete the folder / reinstall will work)

 

Alternatively, you can always download the default sample scripts from the Additional User Scripts thread and unzip them to that folder.

Link to comment
  • 2 weeks later...
On 6/25/2016 at 4:23 PM, Squid said:

argumentDescription if present this will bring up a pop up asking the user for the argument list for the script.  Note that currently arguments do not accept spaces contained within one argument (ie: quoting and escaping spaces does NOT work)

argumentDefault this is the default arguments for the above

 

Any examples with these? Specifically how to safely use a password. I'm not a linux guy, but I do have programming experience so I usually brute force and test this stuff out, but I'm not happy with that method if passwords and security are on the line.

 

This is what I am trying to do:

#!/bin/bash
#description=Mounts EncFS encrypted filesystems
#arrayStarted=true
#argumentDescription=Enter password
#argumentDefault=password

echo $1 | enfcs -S /encrypted /decrypted/

 

I've seen other examples that write the password into a file, mount the decrypted dir, then delete the file. Is that a better method?

Link to comment

Hey :) 

 

 

I'm using Rclone and have imported the script to User Scripts, and it works :) Now I want to schedule it every night at 03:00 am 

 

So I'm choose the custom option in User scripts and pasting the following in to the box

 

0 3 * * * 

 

Would that work?

Link to comment
2 minutes ago, fc0712 said:

Hey :) 

 

 

I'm using Rclone and have imported the script to User Scripts, and it works :) Now I want to schedule it every night at 03:00 am 

 

So I'm choose the custom option in User scripts and pasting the following in to the box

 

0 3 * * * 

 

Would that work?

Yes

Link to comment
11 minutes ago, dlandon said:

Would it be possible to add a script variable to clear the log whenever the script is run?

#clearLog=true

 

I have a weekly task I run and I don't want the log to grow.  I'd just like to have the last run log show.

Sure

Link to comment
1 hour ago, Squid said:

Does it work on the 2nd script?  There was a problem a rev or two before with that, but I thought it got fixed...

No.  The active area for the Help is also way too wide on the first script.  It is all the way over to the right at the script buttons.  Not sure if this was a feature or not.

Link to comment
On 3/3/2017 at 9:42 AM, dlandon said:

The download log button does not appear to be working.  On my first script, it turns the Help on and off.

It's dynamix messing up the placement of the help cursor due to how the table gets filled out.  My simple solution is to just always display the cron format at the bottom.

Link to comment

Having a weird issue using the "description" variable.

 

In the Clean Docker Logs script, I killed the description file and moved it to a variable with this as the first line of the script:
 

#description=Clean up docker log sizes on your system

However,  this doesn't work and the user scripts UI tells me no description is present

 

I removed one word at a time to see what was breaking it, and it wasn't until I removed the words "on your system" that it worked:

#description=Clean up docker log sizes

This isn't about line length since other scripts I'm using descriptions that are much longer, such as

#description=This script will display the size of your docker logs, so you can see if runaway logging is contributing to your docker.img file filling up

What am I missing?

Edited by tmchow
Link to comment
Having a weird issue using the "description" variable.
 
In the Clean Docker Logs script, I killed the description file and moved it to a variable with this as the first line of the script:
 
#description=Clean up docker log sizes on your system

However,  this doesn't work and the user scripts UI tells me no description is present
 
I removed one word at a time to see what was breaking it, and it wasn't until I removed the words "on your system" that it worked:

#description=Clean up docker log sizes

This isn't about line length since other scripts I'm using descriptions that are much longer, such as

#description=This script will display the size of your docker logs, so you can see if runaway logging is contributing to your docker.img file filling up

What am I missing?


PM or post the entire script and I'll check it out in a couple days (AFK due to Work)

Sent from my SM-T560NU using Tapatalk

Link to comment
54 minutes ago, Squid said:


PM or post the entire script and I'll check it out in a couple days (AFK due to Work)

Sent from my SM-T560NU using Tapatalk
 

 

#description=Clean up docker log sizes on your system
echo ""
echo "<font color='red'><b>Before:</b></font>"
echo "====================================================================================================================================================================================="
du -ah /var/lib/docker/containers/ | grep -v "/$" | sort -rh | head -60 | grep .log
echo "====================================================================================================================================================================================="
echo "Cleaning Logs:"
logs=$(find /var/lib/docker/containers/ -name '*.log');for log in $logs; do cat /dev/null > $log;done
sleep 6
echo "...<font color='blue'>cleaning complete!</font>"

echo ""
echo "<font color='green'><b>After:</b></font>"
echo "====================================================================================================================================================================================="
du -ah /var/lib/docker/containers/ | grep -v "/$" | sort -rh | head -60 | grep .log
echo ""

 

Edited by tmchow
Link to comment
Version 2017.03.05 does not let me download logs.  Clicking any script download icons does nothing.  At least now I don't get the Help when I click the first script icon.

Downloads for me. How I checked the clear logs option. Is it the first line again?

Sent from my LG-D852 using Tapatalk

Link to comment
2 hours ago, Squid said:


Downloads for me. How I checked the clear logs option. Is it the first line again?

Sent from my LG-D852 using Tapatalk
 

Well crap!  I got a pop ups blocked message in Chrome and when I enabled them I got a download.  My bad.

 

What is the variable for clearing the log?  I don't see it in the Help.

Link to comment
Well crap!  I got a pop ups blocked message in Chrome and when I enabled them I got a download.  My bad.
 
What is the variable for clearing the log?  I don't see it in the Help.

I keep all that in the 2nd post. clearLog as you asked for

Sent from my LG-D852 using Tapatalk

Link to comment

I think I will install this tonight when I get home.  How can I add these so they all run at once.  I want to be able to delete ALL the .files that Apple puts on the shares.  These are the ones I can think of right now.  If someone could write this for me I would really appreciate it.  I then might be able to look at the file a figure out how to add new ones myself.  Thanks

 

._.DS_Store

.AppleDB

.AppleDesktop

.AppleDouble

.TemporaryItems

Edited by squirrellydw
Link to comment

So I just looked at a script and if I want to add my own all I really need to do is replace whats in bold correct?  and the same with the other two files

 

#!/bin/bash
echo "Searching for (and deleting) .DS_Store Files"
echo "This may take a awhile"
find /mnt/user -maxdepth 9999 -noleaf -type f -name ".DS_Store" -exec rm "{}" \;

 

Is there away to add all these to one script?

_.DS_Store

.AppleDB

.AppleDesktop

.AppleDouble

.TemporaryItems

 

thanks

Edited by squirrellydw
Link to comment
6 hours ago, squirrellydw said:

So I just looked at a script and if I want to add my own all I really need to do is replace whats in bold correct?  and the same with the other two files

 

#!/bin/bash
echo "Searching for (and deleting) .DS_Store Files"
echo "This may take a awhile"
find /mnt/user -maxdepth 9999 -noleaf -type f -name ".DS_Store" -exec rm "{}" \;

 

Is there away to add all these to one script?

_.DS_Store

.AppleDB

.AppleDesktop

.AppleDouble

.TemporaryItems

 

thanks

Just repeat the set of lines changing the file names as appropriate.

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.