Andrea3000 Posted August 22, 2022 Share Posted August 22, 2022 (edited) 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 August 22, 2022 by Andrea3000 Quote Link to comment
bowencool Posted September 9, 2022 Share Posted September 9, 2022 I have some trouble with cron: shouldn't it be executed on September 6th? Quote Link to comment
Squid Posted September 9, 2022 Author Share Posted September 9, 2022 Instead of using ranges, try 1,2,3,4,5,6,7,15,16,17,18,19,20,21 Quote Link to comment
mathgoy Posted September 11, 2022 Share Posted September 11, 2022 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!!! Quote Link to comment
frank-unr Posted September 12, 2022 Share Posted September 12, 2022 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? Quote Link to comment
Squid Posted September 13, 2022 Author Share Posted September 13, 2022 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. Quote Link to comment
frank-unr Posted September 19, 2022 Share Posted September 19, 2022 (edited) 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 September 19, 2022 by frank-unr Quote Link to comment
thebobs Posted September 26, 2022 Share Posted September 26, 2022 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 Quote Link to comment
trurl Posted September 26, 2022 Share Posted September 26, 2022 12 minutes ago, thebobs said: Tried a few different ways of formatting the crontab Examples? Quote Link to comment
thebobs Posted September 26, 2022 Share Posted September 26, 2022 Sorry trurl, thanks for your reply 03*** is what worked before - currently entered as shown in log tried without success: 03*/1** Quote Link to comment
Squid Posted September 26, 2022 Author Share Posted September 26, 2022 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 Quote Link to comment
thebobs Posted September 26, 2022 Share Posted September 26, 2022 Squid, read that spaces were optional. Will try and report back tomorrow. Thanks Quote Link to comment
thebobs Posted September 27, 2022 Share Posted September 27, 2022 No luck after adding spaces. 0 3 * * * Quote Link to comment
Squid Posted September 27, 2022 Author Share Posted September 27, 2022 What's the output of cat /etc/cron.d/root Quote Link to comment
thebobs Posted September 27, 2022 Share Posted September 27, 2022 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 Quote Link to comment
DataHearth Posted October 1, 2022 Share Posted October 1, 2022 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! Quote Link to comment
thebobs Posted October 3, 2022 Share Posted October 3, 2022 Found the issue. Somehow the time on my server was way off. Once fixed the script works perfectly. Sorry for taking people's time Quote Link to comment
spidobot Posted October 5, 2022 Share Posted October 5, 2022 (edited) 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 October 5, 2022 by spidobot Quote Link to comment
Squid Posted October 5, 2022 Author Share Posted October 5, 2022 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 Quote Link to comment
Squid Posted October 5, 2022 Author Share Posted October 5, 2022 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 Quote Link to comment
spidobot Posted October 5, 2022 Share Posted October 5, 2022 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 Quote Link to comment
MasterMark Posted October 14, 2022 Share Posted October 14, 2022 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... Quote Link to comment
Squid Posted October 14, 2022 Author Share Posted October 14, 2022 cron in slackware isn't a complete implementation of the most advanced features. I'd simply do 2,7,12,.... * * * * Quote Link to comment
MasterMark Posted October 14, 2022 Share Posted October 14, 2022 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. Quote Link to comment
Unpack5920 Posted October 17, 2022 Share Posted October 17, 2022 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. Quote Link to comment
Recommended Posts
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.