Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Plugin] CA User Scripts

Featured Replies

21 minutes ago, Squid said:

I tested with * * * * * on 6.9.2 and 6.11 and no issues with it (subject to 6.9 not adding the cron until it was started)

 

I’m on 6.10.3 and * * * * * only works after I disable and then re-enable the schedules.

 

I don’t remember having had this issue when I was on 6.9.x

Edited by Andrea3000

  • 3 weeks later...
  • Replies 2.1k
  • Views 567.1k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • 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

  • Hi All - We have a fix and are publishing a Connect plugin update to fix it today. Thanks for letting us know.

  • @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

image.thumb.png.c21e771dcf64da0c2e3006b0b18496af.png

I have some trouble with cron: shouldn't it be executed on September 6th?

  • Author

Instead of using ranges, try 1,2,3,4,5,6,7,15,16,17,18,19,20,21

Gents, I am using a script which is supposed to delete old footage from my CCTV cameras. 

 

The footage are stored in a folder named "/mnt/cctv/reolink/JardinHD" where "JardinHD" is the name of my camera. 

However, the camera will create some subfolders in there. 1 per yere, 1 per month and 1 per day. 

 

Therefore, the following script that I found on that thread doesn't seem to work:

 

#!/bin/bash
#name=Remove old surveillance recordings
#description=Removes old files and folders from cam1 and cam2 folder
#arrayStarted=true
find /mnt/cctv/reolink/JardinHD -type f -mtime +1 -delete
find /mnt/cctv/reolink/JardinHD  -type d -empty -delete

 

To run the test, I am trying to delete all footage older than 1 day. 

 

So how could I adapt that piece of script so it will handle the subfolders the camera is creating?

 

Thanks!!!

I have a user script than run a rclone sync command. Files created have root only permissions.

Is there any way to have the script run as nobody:users and create files with the correct permissions for files in the array?

  • Author
16 hours ago, frank-unr said:

Is there any way to have the script run as nobody:users

No.  Run a chmod after the rclone is finished or adjust the script parameters accordingly.

On 9/13/2022 at 10:29 AM, Squid said:

No.  Run a chmod after the rclone is finished or adjust the script parameters accordingly.

Thanks,

Ok but files are owned by root now. So I would need to run a chown and chmod after rclone then to end up with nobody:users and correct permissions for files on shares?

 

What do you mean by adjust the script parameters? rclone options?

Edited by frank-unr

I've been using USER SCRIPTS for sometime with success for a script tha tpowerdoens my server at 3 am each night. Something now has changed where my crontab isn't parsing (see syslog entry below). This script has been running for years but now it does not execute. The script runs fine when I hit run script from within USER SCRIPTS.  Tried a few different ways of formatting the crontab. No luck.

 

I reading through this thread I'm wondering if another plugin is interfering.

 

I run:

CA Auto Update Applications

Community Applications

Dynamix File Manager

Dynamix Local Master

Fix Common Problems

My Servers

Unassigned Devices

Unassigned Devices Plus

Unbalanced

 

Any ideas? Thanks ahead of time.

 

 

crond[1407]: failed parsing crontab for user root: 03*** /usr/local/emhttp/plugins/user.scripts/startCustom.php /boot/config/plugins/user.scripts/scripts/Powerdown_Unraid/script > /dev/null 2>&1

12 minutes ago, thebobs said:

Tried a few different ways of formatting the crontab

Examples?

Sorry trurl, thanks for your reply

03*** is what worked before - currently entered as shown in log

tried without success:

03*/1**

 

 

  • Author
1 hour ago, thebobs said:

Sorry trurl, thanks for your reply

03*** is what worked before - currently entered as shown in log

tried without success:

03*/1**

 

 

You're missing spaces between the numbers / *'s

Squid, read that spaces were optional. Will try and report back tomorrow. Thanks

No luck after adding spaces. 0 3 * * *

  • Author

What's the output of

cat /etc/cron.d/root

 

Linux 5.19.9-Unraid.
root@Tower:~# cat /etc/cron.d/root
# Generated docker monitoring schedule:
10 */6 * * * /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/dockerupda              te check &> /dev/null

# Generated system monitoring schedule:
*/1 * * * * /usr/local/emhttp/plugins/dynamix/scripts/monitor &> /dev/null

# Generated mover schedule:
10 1 * * * /usr/local/sbin/mover &> /dev/null

# Generated plugins version check schedule:
10 */6 * * * /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/pluginchec              k &> /dev/null

# Generated ssd trim schedule:
0 20 * * * /sbin/fstrim -a -v | logger &> /dev/null

# Generated array status check schedule:
20 */8 * * * /usr/local/emhttp/plugins/dynamix/scripts/statuscheck &> /dev/null


# CRON for CA background scanning of applications
54 * * * * php /usr/local/emhttp/plugins/community.applications/scripts/notices.              php > /dev/null 2>&1

# Generated local master browser check:
*/1 * * * * /usr/local/emhttp/plugins/dynamix.local.master/scripts/localmaster &              > /dev/null

# Generated cron schedule for user.scripts
0 3 * * * /usr/local/emhttp/plugins/user.scripts/startCustom.php /boot/config/pl              ugins/user.scripts/scripts/Powerdown_Unraid/script > /dev/null 2>&1

Hey!

I've been using user.scripts for triggering my backup script ever 3 days, but I noticed since I upgrade to unRAID v6.10.3 (I haven't check before this version bc it was working, I guess) that I get 2 behavior with it. One is doing what it's supposed to do via the run script button, another one when it's in running in background or via the run in background button. I'm more interested in the background method to automate my backups.

 

To be more specific, I'm using "rclone" and "restic" to backup everything to "storj" data center. rclone has its configuration working and stored as file in $HOME/.config/rclone/rclone.conf which is setted up automatically by another script, and a simple script to backup everything:

 

#!/bin/bash

echo $(rclone config file)

export RESTIC_PASSWORD=ABEAUTIFULPASSWORD
export RESTIC_REPOSITORY=rclone:storj:SERVER/LOCATION

echo "Starting backup..."
restic backup --exclude-file=/boot/config/plugins/user.scripts/scripts/backup_data/excludes.txt >
restic forget --keep-last 2 --prune
echo "Backup finished successfully"

 

Everything is working as intended with run script or by using bash /boot/config/plugins/user.scripts/scripts/backup_data/script

 

But when running in the backup I get this output from the script run

Script Starting Oct 01, 2022  12:04.54

Full logs for this script are available at /tmp/user.scripts/tmpScripts/backup_data/log.txt

Configuration file doesn't exist, but rclone will use this path: /.config/rclone/rclone.conf # <======= debug line to test if rclone detect the config file in the context. It should point to /root/.config/rclone/rclone.conf. Command "rclone config file"

Starting backup...
rclone: 2022/10/01 12:04:54 NOTICE: Config file "/.config/rclone/rclone.conf" not found - using defaults
rclone: 2022/10/01 12:04:54 Failed to create file system for "storj:cronos/backup": didn't find section in config file
Fatal: unable to open repo at rclone:storj:cronos/backup: error talking HTTP to rclone: Get "http://localhost/file-5577006791947779410": unexpected EOF
rclone: 2022/10/01 12:04:54 NOTICE: Config file "/.config/rclone/rclone.conf" not found - using defaults
rclone: 2022/10/01 12:04:54 Failed to create file system for "storj:cronos/backup": didn't find section in config file
Fatal: unable to open repo at rclone:storj:cronos/backup: error talking HTTP to rclone: Get "http://localhost/file-5577006791947779410": unexpected EOF
Backup finished successfully
Script Finished Oct 01, 2022  12:04.54

 

I noticed that when running in background, rclone doesn't use my configuration file (like it doesn't exists) and as fallback try using the /.config/rclone/rclone.conf which is not right as rclone default behavior should look up at $HOME/.config/rclone/rclone.conf

 

Any idea why I get 2 behavior with the script?

Thanks!

Found the issue. Somehow the time on my server was way off. Once fixed the script works perfectly. Sorry for taking people's time

hi folks

i'm having a problem with the custom scheduling of the user scripts plugin.

after doing some trial and error, i found, that the day parameter of the cron doesn't seem to work, or that i'm using it wrongly. (i assume it's the last one)

script works and gets executed manually and also automatically via cron, whejn the day parameter is set to * .

when i set it to anything other, the script is not executed.

 

example:

32 9 1-7 * * -> works, script is being executed

32 9 1-7 * wed -> does not work

32 9 1-7 * 3 -> does not work

and with 1,2,3,4,5,6,7 instead did not change anything, sadly

 

 

if anyone is able to help, would make me pretty happy. use case is, that the script should be executed on every first monday every month. -> https://crontab.guru/#0_0_1-7_*_mon (copied it from there to minimize errors) but this is not being executed :(

i'm running unraid 6.11.0

update_cron and rebooting did not solve this issue

 

 

 

Edited by spidobot

  • Author

Wed will not work (slackware does not support that)

 

For the others, there should be no problems.  Post the output of 

 cat /etc/cron.d/root

 

  • Author
1 hour ago, spidobot said:

if anyone is able to help, would make me pretty happy. use case is, that the script should be executed on every first monday every month

Try this

0 0 * * 1 [[ $(date +%e) -le 7 ]] && 

First Monday of every month at midnight

5 minutes ago, Squid said:

Try this

0 0 * * 1 [[ $(date +%e) -le 7 ]] && 

First Monday of every month at midnight

 

thanks for the quick reply! this did the trick.

when entering "cat /etc/cron.d/root i learned why to enter it that way. guess you learn something new everyday :)

 

cat /etc/cron.d/root
# Generated docker monitoring schedule:
10 0 * * 1 /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/dockerupdate check &> /dev/null

# Generated system monitoring schedule:
*/1 * * * * /usr/local/emhttp/plugins/dynamix/scripts/monitor &> /dev/null

# Generated mover schedule:
30 0 * * * /usr/local/sbin/mover &> /dev/null

# Generated parity check schedule:
30 0 * * 1 [[ $(date +%e) -le 7 ]] && /usr/local/sbin/mdcmd check  &> /dev/null || :
# Generated plugins version check schedule:
10 0 * * 1 /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugincheck &> /dev/null

# Generated array status check schedule:
20 0 * * 1 /usr/local/emhttp/plugins/dynamix/scripts/statuscheck &> /dev/null

# Generated Unraid OS update check schedule:
11 0 * * 1 /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/unraidcheck &> /dev/null

# Generated cron settings for docker autoupdates
0 1 * * 1 /usr/local/emhttp/plugins/ca.update.applications/scripts/updateDocker.php >/dev/null 2>&1
# Generated cron settings for plugin autoupdates
0 1 * * 1 /usr/local/emhttp/plugins/ca.update.applications/scripts/updateApplications.php >/dev/null 2>&1

# CRON for CA background scanning of applications
35 * * * * php /usr/local/emhttp/plugins/community.applications/scripts/notices.php > /dev/null 2>&1

# Generated cron schedule for user.scripts
36 10 1-7 * WED /usr/local/emhttp/plugins/user.scripts/startCustom.php /boot/config/plugins/user.scripts/scripts/ServerReboot/script > /dev/null 2>&1
  • 2 weeks later...

 

2/5 * * * *

 

Why this custom cron is not working correctly?

 

I would like to run script every 5 minutes, but with an offset. So like 2, 7, 12, 17, 22, etc...

  • Author

cron in slackware isn't a complete implementation of the most advanced features.

 

I'd simply do 2,7,12,.... * * * *

10 minutes ago, Squid said:

cron in slackware isn't a complete implementation of the most advanced features.

 

I'd simply do 2,7,12,.... * * * *

 

Oh I see. Thanks.

Small Feature-Request

 

Could you please sort the User Script List by name.

I use script names like:

  • backup-share_docker
  • backup-share_appdata
  • cleanup-delete_ds_store
  • power-force_sleep
  • ...

Sorting would group them accordingly

Thank you in advance.

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.