[Plugin] CA User Scripts


Recommended Posts

Lol

Awesome. I'm glad I could be of some service. xD

 

I'll have to wait on the Check for Updates. Last time I tried to check the plugins well it took forever and I gave up. As soon as that all stabilizes I'll give this a look see again. 

 

I'll follow up with what I find out again. Plugins/Apps appear to be working again. :x

Link to comment

@Squid

 

Started up my Tester Script before the Parity Check.

Let it alert me every 5 minutes for 10 or 15 minutes and then I started up the Parity Check and I relieved another message, but I'm guessing like you said it wasn't fully running.

After the first message I no longer received any messages for at least 15 minutes. Stopped the parity check and I started getting messages again. 

 

#!/bin/bash
#noParity=true

/usr/local/emhttp/plugins/dynamix/scripts/notify -e "Testing the Message System 1" -d "$(date +%D-%H:%I) Testing the Message System 2" -i "normal"

So looks like we have a winner. :D

Link to comment

My system is not updating the User Scripts plugin. I also tried to remove it in order to install it again without any success. It comes back to the same status.

 

The same was also happening with the CA Plugin but I managed to update it directly in the Apps tab.

 

Can the User Scripts plugin be manually updated or removed via command line?

Capture.JPG

Link to comment
My system is not updating the User Scripts plugin. I also tried to remove it in order to install it again without any success. It comes back to the same status.
 
The same was also happening with the CA Plugin but I managed to update it directly in the Apps tab.
 
Can the User Scripts plugin be manually updated or removed via command line?
Capture.thumb.JPG.ac14fcdc5ae060500e6562dd82eee5dc.JPG
You uninstall the advanced buttons plugin. It's incompatible
Link to comment
45 minutes ago, Squid said:
4 hours ago, BBriner said:
My system is not updating the User Scripts plugin. I also tried to remove it in order to install it again without any success. It comes back to the same status.
 
The same was also happening with the CA Plugin but I managed to update it directly in the Apps tab.
 
Can the User Scripts plugin be manually updated or removed via command line?
Capture.thumb.JPG.ac14fcdc5ae060500e6562dd82eee5dc.JPG

You uninstall the advanced buttons plugin. It's incompatible

 

Thanks. Guess what? I can't remove Advanced Buttons too!

Link to comment
3 minutes ago, BBriner said:

Thanks. Guess what? I can't remove Advanced Buttons too!

 

Go to config/plugins folder on your flash drive and delete the .plg for Advanced Buttons then reboot.

 

But even before doing that, read the update notes for updating to 6.5. You may have other things that need to be changed for the new version.

 

See here:

 

 https://lime-technology.com/forums/topic/66327-unraid-os-version-650-stable-release-update-notes/

 

 

Link to comment
31 minutes ago, trurl said:

 

Go to config/plugins folder on your flash drive and delete the .plg for Advanced Buttons then reboot.

 

But even before doing that, read the update notes for updating to 6.5. You may have other things that need to be changed for the new version.

 

See here:

 

 https://lime-technology.com/forums/topic/66327-unraid-os-version-650-stable-release-update-notes/

 

 

 

Thanks! Problem solved!

Link to comment
  • 4 weeks later...

@Squid, this plug-in is fantastic!

 

I love the ability to execute a script both At Startup of Array, but I now I have a script that modifies /root/.bash_profile, and I really need to execute it at boot time, regardless of whether the array has started yet, and even if the array is configured so as not to automatically start at all.

 

So, I'm requesting an "At Boot" (or "After Boot") scheduling option, if it is workable and ever fits into what you are working on.

 

Thanks for your consideration!

Link to comment
2 hours ago, bland328 said:

@Squid, this plug-in is fantastic!

 

I love the ability to execute a script both At Startup of Array, but I now I have a script that modifies /root/.bash_profile, and I really need to execute it at boot time, regardless of whether the array has started yet, and even if the array is configured so as not to automatically start at all.

 

So, I'm requesting an "At Boot" (or "After Boot") scheduling option, if it is workable and ever fits into what you are working on.

 

Thanks for your consideration!

The old method of running commands in the config/go file still works and happens at boot.

Link to comment

I got a message stating that my Parity Check started this AM and I thought well I better shut off my regularly scheduled scripts. 

I double checked my scripts and realized they are not running and realized I used #noParity=true on all of them and never had a chance to really tested it. Well Test complete and everything seems to be delayed like I wanted them to be. Thanks @Squid  :D

Link to comment

I created the following script (it makes nextcloud scan all files to add files which were not uplodaed thru app (e.g. SMB)

 



#!/bin/bash
echo "====================================================================================================================================================================================="
echo "<font color='red'><b>Starting...</b></font>"
echo "====================================================================================================================================================================================="

docker exec -i nextcloud sudo -u abc php /config/www/nextcloud/occ files:scan --all
echo "====================================================================================================================================================================================="
echo "<font color='green'><b>Finished:</b></font>"
echo "====================================================================================================================================================================================="

 

 

Is it possible to display something to the unraid log about this script run?

Link to comment

I googled it, but didnt find anything on how to use it.


From help it seems it can only write to log from file?

Enter messages into the system log.

Options:
 -i                       log the logger command's PID
     --id[=<id>]          log the given <id>, or otherwise the PID
 -f, --file <file>        log the contents of this file
 -e, --skip-empty         do not log empty lines when processing files
     --no-act             do everything except the write the log
 -p, --priority <prio>    mark given message with this priority
     --octet-count        use rfc6587 octet counting
     --prio-prefix        look for a prefix on every line read from stdin
 -s, --stderr             output message to standard error as well
 -S, --size <size>        maximum size for a single message
 -t, --tag <tag>          mark every line with this tag
 -n, --server <name>      write to this remote syslog server
 -P, --port <port>        use this port for UDP or TCP connection
 -T, --tcp                use TCP only
 -d, --udp                use UDP only
     --rfc3164            use the obsolete BSD syslog protocol
     --rfc5424[=<snip>]   use the syslog protocol (the default for remote);
                            <snip> can be notime, or notq, and/or nohost
     --sd-id <id>         rfc5424 structured data ID
     --sd-param <data>    rfc5424 structured data name=value
     --msgid <msgid>      set rfc5424 message id field
 -u, --socket <socket>    write to this Unix socket
     --socket-errors[=<on|off|auto>]
                          print connection errors when using Unix sockets

 -h, --help               display this help
 -V, --version            display version

 

is that true?

 

Edit:

okay it was too easy.


logger test displays 

May 4 12:54:47 Unraid-Server root: test

 

Thanks for the fast help!

 

Edited by nuhll
Link to comment

Yep, i found out, was too easy, thanks! :D

Finally:

 

Script which start nextcloud file sync for all users, with logger output to syslog on unraid

 

Quote

 


 

#!/bin/bash
echo "====================================================================================================================================================================================="
echo "<font color='red'><b>Starting...</b></font>"
logger Nextcloud filescan started.
echo "====================================================================================================================================================================================="


docker exec -i nextcloud sudo -u abc php /config/www/nextcloud/occ files:scan --all
echo "====================================================================================================================================================================================="
logger Nextcloud filescan finished.
echo "<font color='green'><b>Finished:</b></font>"
echo "====================================================================================================================================================================================="

 

 

 

Edited by nuhll
Link to comment

Cleaning script for your archives, logs to syslog.

 

Just change the directorys to fit yours. If you need more extentions, just add them, if you dotn want to remove some extentions, remove the according lines. First block is something you want to delete on all shares, second block is for files which shouldnt be inside movies/series/dokus - but .e.g in games.

 

You could remove the logger entries, but i like to see whats happening... :)

 

Someone know if theres are clever way to remove files WITHOUT an EXTENTION? e.g." SOMEFILE"


Script is very fast, example output:

 

Quote

 


May 4 13:52:07 Unraid-Server root: Aufräumen gestartet...
May 4 13:52:07 Unraid-Server root: *.jpg gelöscht.
May 4 13:52:07 Unraid-Server root: *.url gelöscht.
May 4 13:52:07 Unraid-Server root: *.html gelöscht.
May 4 13:52:07 Unraid-Server root: *.m3u gelöscht.
May 4 13:52:08 Unraid-Server root: *.htm gelöscht.
May 4 13:52:08 Unraid-Server root: *.log gelöscht.
May 4 13:52:08 Unraid-Server root: *sample.* gelöscht.
May 4 13:52:08 Unraid-Server root: *.nzb gelöscht.
May 4 13:52:08 Unraid-Server root: *.ini gelöscht.
May 4 13:52:09 Unraid-Server root: *.diz gelöscht.
May 4 13:52:09 Unraid-Server root: *.nfo in Filme gelöscht.
May 4 13:52:09 Unraid-Server root: *.nfo in Musik gelöscht.
May 4 13:52:09 Unraid-Server root: *.nfo in Dokumentationen gelöscht.
May 4 13:52:09 Unraid-Server root: *.nfo in Serien gelöscht.
May 4 13:52:09 Unraid-Server root: *.exe in Filme gelöscht.
May 4 13:52:09 Unraid-Server root: *.exe in Musik gelöscht.
May 4 13:52:09 Unraid-Server root: *.exe in Dokumentationen gelöscht.
May 4 13:52:09 Unraid-Server root: *.exe in Serien gelöscht.
May 4 13:52:09 Unraid-Server root: *.rar in Filme gelöscht.
May 4 13:52:09 Unraid-Server root: *.rar in Musik gelöscht.
May 4 13:52:09 Unraid-Server root: *.rar in Dokumentationen gelöscht.
May 4 13:52:09 Unraid-Server root: *.rar in Serien gelöscht.
May 4 13:52:09 Unraid-Server root: *.zip in Filme gelöscht.
May 4 13:52:09 Unraid-Server root: *.zip in Musik gelöscht.
May 4 13:52:09 Unraid-Server root: *.zip in Dokumentationen gelöscht.
May 4 13:52:09 Unraid-Server root: *.zip in Serien gelöscht.
May 4 13:52:09 Unraid-Server root: *.txt in Filme gelöscht.
May 4 13:52:09 Unraid-Server root: *.txt in Musik gelöscht.
May 4 13:52:09 Unraid-Server root: *.txt in Dokumentationen gelöscht.
May 4 13:52:10 Unraid-Server root: *.txt in Serien gelöscht.
May 4 13:52:10 Unraid-Server root: Aufräumen beendet.
 

 

 

Quote

#!/bin/bash
logger Aufräumen gestartet...
find /mnt/user/Archiv -name *.jpg -delete
logger *.jpg gelöscht.
find /mnt/user/Archiv -name *.url -delete
logger *.url gelöscht.
find /mnt/user/Archiv -name *.html -delete
logger *.html gelöscht.
find /mnt/user/Archiv -name *.m3u -delete
logger *.m3u gelöscht.
find /mnt/user/Archiv -name *.htm -delete
logger *.htm gelöscht.
find /mnt/user/Archiv -name *.log -delete
logger *.log gelöscht.
find /mnt/user/Archiv -name *sample.* -delete
logger *sample.* gelöscht.
find /mnt/user/Archiv -name *.nzb -delete
logger *.nzb gelöscht.
find /mnt/user/Archiv -name *.ini -delete
logger *.ini gelöscht.
find /mnt/user/Archiv -name *.diz -delete
logger *.diz gelöscht.


find /mnt/user/Archiv/Filme -name *.nfo -delete
logger *.nfo in Filme gelöscht.
find /mnt/user/Archiv/Musik -name *.nfo -delete
logger *.nfo in Musik gelöscht.
find /mnt/user/Archiv/Dokumentationen -name *.nfo -delete
logger *.nfo in Dokumentationen gelöscht.
find /mnt/user/Archiv/Serien -name *.nfo -delete
logger *.nfo in Serien gelöscht.

find /mnt/user/Archiv/Filme -name *.exe -delete
logger *.exe in Filme gelöscht.
find /mnt/user/Archiv/Musik -name *.exe -delete
logger *.exe in Musik gelöscht.
find /mnt/user/Archiv/Dokumentationen -name *.exe -delete
logger *.exe in Dokumentationen gelöscht.
find /mnt/user/Archiv/Serien -name *.exe -delete
logger *.exe in Serien gelöscht.

find /mnt/user/Archiv/Filme -name *.rar -delete
logger *.rar in Filme gelöscht.
find /mnt/user/Archiv/Musik -name *.rar -delete
logger *.rar in Musik gelöscht.
find /mnt/user/Archiv/Dokumentationen -name *.rar -delete
logger *.rar in Dokumentationen gelöscht.
find /mnt/user/Archiv/Serien -name *.rar -delete
logger *.rar in Serien gelöscht.

find /mnt/user/Archiv/Filme -name *.zip -delete
logger *.zip in Filme gelöscht.
find /mnt/user/Archiv/Musik -name *.zip  -delete
logger *.zip in Musik gelöscht.
find /mnt/user/Archiv/Dokumentationen -name *.zip -delete
logger *.zip in Dokumentationen gelöscht.
find /mnt/user/Archiv/Serien -name *.zip -delete
logger *.zip in Serien gelöscht.

find /mnt/user/Archiv/Filme -name *.txt -delete
logger *.txt in Filme gelöscht.
find /mnt/user/Archiv/Musik -name *.txt -delete
logger *.txt in Musik gelöscht.
find /mnt/user/Archiv/Dokumentationen -name *.txt -delete
logger *.txt in Dokumentationen gelöscht.
find /mnt/user/Archiv/Serien -name *.txt -delete
logger *.txt in Serien gelöscht.


logger Aufräumen beendet.

Edited by nuhll
Link to comment
1 hour ago, Stupifier said:

Quick question.....does UserScripts support some of the more complex Cron Time coding? For example, does this Script support Cron Code like this example?

https://crontab.guru/#0_3_3-15,17-31_*_*/2

 

The Above example is not really THAT complex, but if you google around, you can see some really funky Cron coding. Just curious if UserScripts supports it all

 

I'm pretty sure he just passes whatever you put in the "custom" field whether it's valid or not. I can't imagine the code goes through all the trouble to parse it. Not sure what happens if it is invalid. I'm sure cron would throw an error but I don't know if that gets displayed to you or not. Try it.

Link to comment
7 minutes ago, trurl said:

I'm pretty sure he just passes whatever you put in the "custom" field whether it's valid or not.

Yup.

 

7 minutes ago, trurl said:

Not sure what happens if it is invalid

Probably crond would log it, and an email will be sent out to whatever email address has been set up in notifications about the crond failure.

 

1 hour ago, Stupifier said:

Just curious if UserScripts supports it all

Anything that cron as installed on unRaid supports can be used.  Only thing off of the top of my head is that slackware does NOT support day of weeks spelled out (SAT / SUN eg) whereas the online documents say you can.

 

This includes piping the cron expression to another bash command to further refine it

Link to comment
18 minutes ago, Squid said:

Yup.

 

Probably crond would log it, and an email will be sent out to whatever email address has been set up in notifications about the crond failure.

 

Anything that cron as installed on unRaid supports can be used.  Only thing off of the top of my head is that slackware does NOT support day of weeks spelled out (SAT / SUN eg) whereas the online documents say you can.

 

This includes piping the cron expression to another bash command to further refine it

 

So, this should work just fine?

 

0 3 3-15,17-31 * */2

 

Link to comment
On 5/9/2018 at 2:16 PM, Squid said:
On 5/9/2018 at 2:15 PM, Stupifier said:
 
So, this should work just fine?
 


0 3 3-15,17-31 * */2
 

 

Try and see.

 

 

So, according to documentation, the command below:

https://crontab.guru/#0_3_3-15,17-31_*_*/2

0 3 3-15,17-31 * */2

Should do the following:

“At 03:00 on every day-of-month from 3 through 15 and every day-of-month from 17 through 31 if it's on every 2nd day-of-week.”

It is fine with everything in the command EXCEPT that last part.....Boo ?. Here is the strange part.

0 3 3-15,17-31 * *		This works, Script fires
0 3 3-15,17-31 * 4		This does not work, Script just doesn't fire
0 3 3-15,17-31 * */2		This does not work, Script just doesn't fire
0 3 3-15,17-31 * THU		This does not work, Script just doesn't fire

 

 

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

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.