November 3, 20214 yr I'm trying to run a script with the following custom cron schedule: 50 2 * * 2 [[ $(date +%e) -le 7 ]] I wanted the script to run the 1st week of every month on Tuesday at 2:50am but it didn't run this past Tuesday. I just copied the cron schedule for my parity check and made some modifications. Do you see anything wrong with this cron schedule?
November 3, 20214 yr 28 minutes ago, niwmik said: I'm trying to run a script with the following custom cron schedule: 50 2 * * 2 [[ $(date +%e) -le 7 ]] I wanted the script to run the 1st week of every month on Tuesday at 2:50am but it didn't run this past Tuesday. I just copied the cron schedule for my parity check and made some modifications. Do you see anything wrong with this cron schedule? I have a cron I run in Ubuntu that is for the first Saturday of every month. My syntax is: 0 0 * * 6 [ $(date +\%d) -le 07 ] && /script/path/follows/here.sh
November 4, 20214 yr 21 hours ago, cybrnook said: I have a cron I run in Ubuntu that is for the first Saturday of every month. My syntax is: 0 0 * * 6 [ $(date +\%d) -le 07 ] && /script/path/follows/here.sh Thanks for the tip. I changed the cron schedule to "50 2 * * 4 [ $(date +%d) -le 07 ]" and it appears to have run this morning based on what it is in the logs. Nov 4 02:50:01 Atlas crond[2264]: exit status 2 from user root [ $(date +\%d) -le 07 ] /usr/local/emhttp/plugins/user.scripts/startCustom.php /boot/config/plugins/user.scripts/scripts/AutoBackupVM/script > /dev/null 2>&1 However, AutoBackupVM script doesn't appeared to have ran. I just ran it manually to test and it ran successfully. Is there something else I'm missing?
November 4, 20214 yr What is AutoBackupVM? I use my own script to backup VM's. Seems the script is exiting with status 2, so something is not happy. When you run it by hand, after it completes what does "echo $?" return Edited November 4, 20214 yr by cybrnook
November 4, 20214 yr i'm running the clear_array_drive script. The status window shows 2.2 MB/s. At this rate it's going to take about 21 days to complete. Will it speed up? It's a part of the shrink array process but is it really necessary?
November 4, 20214 yr 2 minutes ago, wgstarks said: i'm running the clear_array_drive script. The status window shows 2.2 MB/s. At this rate it's going to take about 21 days to complete. Will it speed up? It's a part of the shrink array process but is it really necessary? Speed sounds about right, the script is not optimized at all. You can either write all zeroes to the data drive, or rebuild parity, either way works, but rebuilding parity is much quicker.
November 4, 20214 yr 4 minutes ago, JonathanM said: Speed sounds about right, the script is not optimized at all. You can either write all zeroes to the data drive, or rebuild parity, either way works, but rebuilding parity is much quicker. That's what I thought. Drive has already been emptied, so now I can just stop the array, remove the drive, create new config and rebuild parity. Did I miss anything? Edited November 4, 20214 yr by wgstarks typo
November 4, 20214 yr 1 minute ago, wgstarks said: That's what I thought. Drive has already been emptied, so now I can just stop the array, remove the drive, create new config and rebuild parity. Did I miss anything? Sounds good!
November 5, 20214 yr 20 hours ago, cybrnook said: What is AutoBackupVM? I use my own script to backup VM's. Seems the script is exiting with status 2, so something is not happy. When you run it by hand, after it completes what does "echo $?" return AutoBackupVM is a script written by an Unraid user that I use to backup my Windows 10 VM. I've never had an issue with it before. I clicked "RUN SCRIPT" in User Scripts to manually run the script so I didn't have access to a terminal screen. As a test, I changed the cron schedule from "Custom" to "Scheduled Monthly" and changed Monthly schedule in Scheduler to run on the 5th. I didn't see anything in the logs this morning but AutoBackupVM did run successfully. As far as I can tell, the script only fails when I set it to a custom cron schedule.
November 15, 20214 yr Does anyone know the GitHub repo for this plugin? I'd like to look though the source code. Thanks, Harry
November 15, 20214 yr 4 hours ago, HarryMuscle said: Does anyone know the GitHub repo for this plugin? I'd like to look though the source code. Thanks, Harry If you have the plugin installed then you can always look at the .txz file in the plugins folder on the flash drive without bothering to go to GitHub.
November 15, 20214 yr Author On 11/4/2021 at 9:47 AM, niwmik said: 50 2 * * 4 [ $(date +%d) -le 07 ] You're going to want to add a cron job via crontab or by placing an application .cron file within /config/dynamix on the flash drive. User scripts will eventually disallow a cron entry like this (when I get to it)
November 19, 20214 yr I don't know if this belongs here: Had serious trouble with rsync commands running wild. Started something like "rsync -avh --delete \\A \\b - huge job, almost 10 TB. I canceled it via userscript-plugin but it did not work. In the end i had about 10 rsync scripts copying the same stuff over and over (because the first ones altered the date/time and the later scripts did not notice). Annoying... Is there a way to include this (i needed "killall rsync" to clean up this mess) or should i provide something with the script to avoid this behaviour.
November 19, 20214 yr I love this - I have so many scripts for automation of everything. I just added a new one to rsync the radarr and sonarr backups out of appdata to external backup disks. What would make this perfect is if I could move the scripts around ?
November 27, 20214 yr I just noticed my cron based scripts last ran on 19th Nov. The dropdown daily, weekly, hourly ones are running fine. I have some scripts for this however : */5 * * * * - very 5 minutes sync video camera data to hidden laptop 30 23 * * * - Backups every night at 23:30 Any idea where I can go to rectify this ? In there a cron process that has stopped or something ?
November 28, 20214 yr On 10/27/2021 at 4:51 PM, Noim said: @Squid My issue still persists. Here is a test script: After aborting it, the script process is still running: What am I doing wrong?! This is how it gets spawned if I press background process: The process 10197 survives if I press abort. Plugin is up-to-date and running on unraid 6.9.2. Because nobody cared, and the dev doesn't even publish the plugin on GitHub, so I could make a pull request I investigated by myself. The abort how it is implemented is flawed. This is my fix. Not elegant, but it works better than the current version. Starting at line 115 in exec.php: case 'abortScript': $script = isset($_POST['name']) ? urldecode(($_POST['name'])) : ""; $pid = file_get_contents("/tmp/user.scripts/running/$script"); exec("pkill -TERM -P $pid"); exec("kill -9 $pid"); $processListOutput = null; exec("ps aux | grep -i '/tmp/user.scripts/tmpScripts/$script' | grep -v grep", $processListOutput); foreach ($processListOutput as $emergencyKill) { $emergencyKill = str_replace("root","",$emergencyKill); $emergencyKill = trim($emergencyKill); $rawKill = explode(" ",$emergencyKill); logger("Kill pid: ".$rawKill[0]); exec("kill -9 ".$rawKill[0]); } @unlink("/tmp/user.scripts/running/$script"); file_put_contents("/tmp/user.scripts/finished/$script","aborted"); file_put_contents("/tmp/user.scripts/tmpScripts/$script/log.txt","Execution was aborted by user\n\n",FILE_APPEND); break; The original version didn't kill all running script instances. And the grep command not even found the correct processes if I tried it manual.
November 28, 20214 yr Author 11 minutes ago, Noim said: dev doesn't even publish the plugin on GitHub, huh? https://github.com/Squidly271/user.scripts
November 28, 20214 yr 43 minutes ago, Squid said: huh? https://github.com/Squidly271/user.scripts Oh, I am sorry. There was no response to @HarryMuscle question and a quick google search wasn't helpful either. So, I just expected there is no repo. I will do a proper pull request.
December 21, 20214 yr I created a script to run in the background, but today the log shows Full logs for this script are available at /tmp/user.scripts/tmpScripts/bypy_mmd/log.txt.Then the script failed to run after retrying several times automatically, and I had to restart the server to run normally.How to solve my trouble?
December 22, 20214 yr Is there a possiblity of a GUI update to be able to organize the scripts within some type of folder structure to help keep them organized?
January 3, 20224 yr Is there a way to skip the Userscript from triggering if the previous run is still running? Currently it seems like the userscript will trigger a new run at the scheduled time even if the previous one is not complete.
January 3, 20224 yr 2 hours ago, bobokun said: Is there a way to skip the Userscript from triggering if the previous run is still running? Currently it seems like the userscript will trigger a new run at the scheduled time even if the previous one is not complete. I believe that the script itself would be responsible for ensuring that only a single instance can run at a time. Adding one of the solutions from this page https://unix.stackexchange.com/questions/48505/how-to-make-sure-only-one-instance-of-a-bash-script-runs would probably do the trick.
January 8, 20224 yr I have a problem with the plugin. I updated the user scripts plugin and afterwards it disappeared from my unraid menu and if I try to open it via the plugins > installed plugins tab and click on it, I get a black screen. Reinstall did not fix the problem. I am on Unraid Version: 6.10.0-rc1 Any ideas?
January 14, 20224 yr Hi i dont know the first thing about scripts but am able to follow instructions well. I am looking for a script that will start my pfsense VM when the array is brought up manually, i found something like "virsh start pfsense" which does not seem to work unless i run it manually after the array has started. can anyone assist me with this ?
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.