phyzical Posted April 8, 2021 Share Posted April 8, 2021 Hey all, This might be a more generic unix question but is there an easy way to enable timestamps for all logs that a "userscript" would produce? quick googling i can do things like pipe my commands into various things to achieve this but i was wondering if there was an easy "turn on for everything in unraid" or maybe just "turn on for user scripts logs"? Thanks in advance! Quote Link to comment
Dr.NAS Posted April 27, 2021 Share Posted April 27, 2021 Hello, i hava a cron job problem. I can't create a job with letters in day. This cron syntax 40 7 * * Tue sends an error in log "failed parsing crontab for user root: TUE" but 40 7 * * 2 works Quote Link to comment
Squid Posted April 27, 2021 Author Share Posted April 27, 2021 That's not a problem. Slackware doesn't support TUE as a cron entry 1 Quote Link to comment
Dr.NAS Posted April 27, 2021 Share Posted April 27, 2021 Thanks, then I do not have to worry Quote Link to comment
MrThistabut Posted April 27, 2021 Share Posted April 27, 2021 Would it be possible to have a way of grouping the scripts together? i have a bunch that run python scripts that id like to seperate from the rest if possible? thanks, Quote Link to comment
Harlequin42 Posted May 3, 2021 Share Posted May 3, 2021 I want to backup my nextcloud and found a good script but had to change some parts for docker. I already figured out how to set the maintenance mode and this works fine docker exec --tty nextcloud sudo -u $webserverUser php $nextcloudDockerFileDir/occ maintenance:mode --off So the script works so far, but i want to improve it. But i was not able to figure out how i could check if the maintenance mode is on or off. I think this is because of the "--tty" but other options work less. Last week the backup worked fine but the maintenance mode was still on. So i want to make a check at the end to switch it off if it is still on or maybe send a message to check the maintenance mode. So how can i check the maintenance mode from outside the docker? Quote Link to comment
cavinyagi Posted May 4, 2021 Share Posted May 4, 2021 Hey all, I'm migrating from and Ubuntu based server and I was trying to set back up one of my scripts. It's a simple script that uses inotifywait to watch a folder and then emails (via mutt) any new pdf files to my kindle. The inotify part works well enough but obviously mutt isn't part of unraid. Is there a command line alternative or even a simple docker container I could use to the same effect? (Short of running a linux vm lol) Quote Link to comment
Squid Posted May 5, 2021 Author Share Posted May 5, 2021 10 hours ago, cavinyagi said: Hey all, I'm migrating from and Ubuntu based server and I was trying to set back up one of my scripts. It's a simple script that uses inotifywait to watch a folder and then emails (via mutt) any new pdf files to my kindle. The inotify part works well enough but obviously mutt isn't part of unraid. Is there a command line alternative or even a simple docker container I could use to the same effect? (Short of running a linux vm lol) If it's not already available within the NerdPack plugin, then you can ask for it to be added, or install (or build from source) a slackware package. Quote Link to comment
cavinyagi Posted May 5, 2021 Share Posted May 5, 2021 4 hours ago, Squid said: If it's not already available within the NerdPack plugin, then you can ask for it to be added, or install (or build from source) a slackware package. Quite a newbie so didn't know about Nerdpack - although mutt (or alt) doesn't seem to be included yet. I may request as you've suggested but I'll try and install one myself first I think as why not? haha Thanks for the help! Quote Link to comment
SimonAG Posted May 9, 2021 Share Posted May 9, 2021 (edited) never mind, I see you use the scheduling to add the cron for you... Edited May 9, 2021 by SimonAG Quote Link to comment
mishmash- Posted May 10, 2021 Share Posted May 10, 2021 (edited) My unraid box has a bit of a custom arrangement, where the GPU has 2x oversized fans - one blows on the GPU directly, and the other on the array drives and the GPU. The GPU controls one of the fans, and unraid controls the array fan. I am trying to set up the ability to calculate and compare a required PWM value for the array drives and the GPU, and then decide which is higher and apply it to the array fan. In my windows VM I use nvidia-smi with a timeout -t 5 loop running on a schedule to constantly update a txt file on the cache drive which unraid can read. This part seems to work ok, windows updates the txt file with the fan % value. I have included in the array fan script (which I found on these forums) an arrangement which takes the percentage and converts it to PWM. The issue is - it does not work with the file that is being dynamically updated by windows, but it does work with a static test file which was created by me in windows and is sitting in the exact same location! I'm pulling my hair out on this, I can't work out why it is not working...any thoughts? #!/bin/bash # unraid_array_fan.sh v0.4 # v0.1 First try at it. # v0.2: Made a small change so the fan speed on low doesn't fluctuate every time the script is run. # v0.3: It will now enable fan speed change before trying to change it. I missed # it at first because pwmconfig was doing it for me while I was testing the fan. # v0.4: Corrected temp reading to "Temperature_Celsius" as my new Seagate drive # was returning two numbers with just "Temperature". # A simple script to check for the highest hard disk temperatures in an array # or backplane and then set the fan to an apropriate speed. Fan needs to be connected # to motherboard with pwm support, not array. # DEPENDS ON:grep,awk,smartctl,hdparm ### VARIABLES FOR USER TO SET ### # Amount of drives in the array. Make sure it matches the amount you filled out below. NUM_OF_DRIVES=2 # unRAID drives that are in the array/backplane of the fan we need to control HD[1]=/dev/sdd HD[2]=/dev/sde #HD[3]=/dev/nvme0n1 #HD[4]=/dev/sdc #HD[5]=/dev/sdf #HD[6]=/dev/sdg # Temperatures to change fan speed at # Any temp between OFF and HIGH will cause fan to run on low speed setting FAN_OFF_TEMP=47 # Anything this number and below - fan is off FAN_HIGH_TEMP=60 # Anything this number or above - fan is high speed # Fan speed settings. Run pwmconfig (part of the lm_sensors package) to determine # what numbers you want to use for your fan pwm settings. Should not need to # change the OFF variable, only the LOW and maybe also HIGH to what you desire. # Any real number between 0 and 255. FAN_OFF_PWM=55 FAN_LOW_PWM=55 FAN_HIGH_PWM=255 # Calculate size of increments. FAN_TEMP_INCREMENTS=$(($FAN_HIGH_TEMP-$FAN_OFF_TEMP)) FAN_PWM_INCREMENTS=$(($(($FAN_HIGH_PWM-$FAN_LOW_PWM))/$FAN_TEMP_INCREMENTS)) # Fan device. Depends on your system. pwmconfig can help with finding this out. # pwm1 is usually the cpu fan. You can "cat /sys/class/hwmon/hwmon0/device/fan1_input" # or fan2_input and so on to see the current rpm of the fan. If 0 then fan is off or # there is no fan connected or motherboard can't read rpm of fan. ARRAY_FAN=/sys/devices/platform/nct6775.656/hwmon/hwmon2/pwm7 ### END USER SET VARIABLES ### #GPU1=1 #GPUFAN=1 GPU1=$(cat /mnt/cache/windows10scratch/w10system/nvidiafan/gpufan.txt) #echo $GPU1 #if [[ "$GPU1" == "" ]]; then # GPU1=1 #elif [[ "$GPU1" == 0 ]]; then # GPU1=1 #fi GPU1=$((GPU1 + 1)) GPUFAN=$(($((GPU1 * 255)) / 100)) echo "GPU1 is "$GPU1 echo "GPUFAN is "$GPUFAN # Program variables - do not modify HIGHEST_TEMP=0 CURRENT_DRIVE=1 CURRENT_TEMP=0 # while loop to get the highest temperature of active drives. # If all are spun down then high temp will be set to 0. while [ "$CURRENT_DRIVE" -le "$NUM_OF_DRIVES" ] do SLEEPING=`hdparm -C ${HD[$CURRENT_DRIVE]} | grep -c standby` if [ "$SLEEPING" == "0" ]; then CURRENT_TEMP=`smartctl -d ata -A ${HD[$CURRENT_DRIVE]} | grep -m 1 -i Temperature_Celsius | awk '{print $10}'` if [ "$HIGHEST_TEMP" -le "$CURRENT_TEMP" ]; then HIGHEST_TEMP=$CURRENT_TEMP fi fi #echo $CURRENT_TEMP let "CURRENT_DRIVE+=1" done echo "Highest temp is: "$HIGHEST_TEMP # Calculate new fan values based on highest drive temperature if [[ $HIGHEST_TEMP -le $FAN_OFF_TEMP ]]; then ADJUSTED_FAN_SPEED=$FAN_OFF_PWM ADJUSTED_PERCENT_SPEED=0 ADJUSTED_OUTPUT="OFF" else if [[ $HIGHEST_TEMP -ge $FAN_HIGH_TEMP ]]; then ADJUSTED_FAN_SPEED=$FAN_HIGH_PWM ADJUSTED_PERCENT_SPEED=100 ADJUSTED_OUTPUT="FULL" else ADJUSTED_FAN_SPEED=$(($(($(($HIGHEST_TEMP-$FAN_OFF_TEMP))*$FAN_PWM_INCREMENTS))+$FAN_LOW_PWM)) ADJUSTED_PERCENT_SPEED=$(($(($ADJUSTED_FAN_SPEED*100))/$FAN_HIGH_PWM)) ADJUSTED_OUTPUT=$ADJUSTED_FAN_SPEED fi fi # Adjust fan to GPU output, if GPU is higher set GPU PWM to adjusted output if [[ $ADJUSTED_FAN_SPEED -le $GPUFAN ]]; then ADJUSTED_FAN_SPEED=$GPUFAN ADJUSTED_OUTPUT=$ADJUSTED_FAN_SPEED fi #echo "Adjusted output is "$ADJUSTED_FAN_SPEED echo "Adjusted output is "$ADJUSTED_OUTPUT # Implemenent fan speed change if neeeded CURRENT_FAN_SPEED=`cat $ARRAY_FAN` if [[ $CURRENT_FAN_SPEED -ne $ADJUSTED_FAN_SPEED ]]; then # Enable speed change on this fan if not already if [ "$ARRAY_FAN" != "1" ]; then echo 1 > "${ARRAY_FAN}_enable" fi # set fan to new value` echo $ADJUSTED_FAN_SPEED > $ARRAY_FAN echo "Setting pwm to: "$ADJUSTED_FAN_SPEED fi Output with the "test.txt" file - works as intended: Script location: /tmp/user.scripts/tmpScripts/Case fan control/script Note that closing this window will abort the execution of this script GPU1 is 51 GPUFAN is 130 Highest temp is: 39 Adjusted output is 130 Setting pwm to: 130 Output with the dynamic "gpufan.txt" file - fails to read gpufan.txt... Script location: /tmp/user.scripts/tmpScripts/Case fan control/script Note that closing this window will abort the execution of this script ") ") GPUFAN is Highest temp is: 39 Adjusted output is OFF Setting pwm to: 55 Edited May 10, 2021 by mishmash- Quote Link to comment
tjb_altf4 Posted May 12, 2021 Share Posted May 12, 2021 Are there any issues with overlapping jobs when scheduling? i.e. ~4hr jobs run every hour Quote Link to comment
TBKU Posted May 12, 2021 Share Posted May 12, 2021 I'm having trouble running a script that backs up my VMs. For some reason, the log buttons are not available, and the script doesn't seem to run according to the CRON schedule I set in the GUI. I also tried using a number 1-7 instead of the three letter day name. I have other scripts running in the middle of the night for backing up shares that are working fine. My only though is that this script is significantly more complicated then the others, but I'm not sure why that would matter. If I run the script manually it works fine. Any ideas? Quote Link to comment
Squid Posted May 12, 2021 Author Share Posted May 12, 2021 8 hours ago, tjb_altf4 said: Are there any issues with overlapping jobs when scheduling? i.e. ~4hr jobs run every hour No 1 Quote Link to comment
Squid Posted May 12, 2021 Author Share Posted May 12, 2021 5 minutes ago, TBKU said: I'm having trouble running a script that backs up my VMs. For some reason, the log buttons are not available, and the script doesn't seem to run according to the CRON schedule I set in the GUI. I also tried using a number 1-7 instead of the three letter day name. I have other scripts running in the middle of the night for backing up shares that are working fine. My only though is that this script is significantly more complicated then the others, but I'm not sure why that would matter. If I run the script manually it works fine. Any ideas? Try getting rid of the spaces Quote Link to comment
TBKU Posted May 12, 2021 Share Posted May 12, 2021 31 minutes ago, Squid said: Try getting rid of the spaces Okay, I'll try that. My other scripts have spaces and they are running on custom cron schedules just fine, though. Quote Link to comment
Squid Posted May 12, 2021 Author Share Posted May 12, 2021 Sorry. Didn't look closely enough. It's the WED that's causing it to never run. Change it to be 3 Quote Link to comment
TBKU Posted May 12, 2021 Share Posted May 12, 2021 1 hour ago, Squid said: Sorry. Didn't look closely enough. It's the WED that's causing it to never run. Change it to be 3 I tried it previous with 0 4 * * 1 and it never ran. I've changed it to 30 9 * * 3 and it seems to have kicked off correctly at 9:30 - still running. I did change the name to all lowercase with no spaces, as suggested. Quote Link to comment
tjb_altf4 Posted May 15, 2021 Share Posted May 15, 2021 On 5/12/2021 at 12:34 PM, tjb_altf4 said: Are there any issues with overlapping jobs when scheduling? i.e. ~4hr jobs run every hour On 5/12/2021 at 8:52 PM, Squid said: No OK this seems to be fine when using the drop down schedules (scheduled Hourly), but as soon I use a custom cron schedule the script won't restart until after the running script finishes. Is this a bug to be resolved, or is there a work around I need to use? Currently wanting to run the script every 30 min with: */30 * * * * Quote Link to comment
tjb_altf4 Posted May 17, 2021 Share Posted May 17, 2021 On 5/15/2021 at 7:27 PM, tjb_altf4 said: is there a work around I need to use? I eventually found that I needed to run the command in the script as background task so the jobs could overlap. Sorted. Quote Link to comment
flobbr Posted May 21, 2021 Share Posted May 21, 2021 I ran user scripts for over a year now but it suddenly disappeared from the settings tab. I removed it via the plugins tab and reinstalled it via CA but get the following message: plugin: installing: https://raw.githubusercontent.com/Squidly271/user.scripts/master/plugins/user.scripts.plg plugin: downloading https://raw.githubusercontent.com/Squidly271/user.scripts/master/plugins/user.scripts.plg plugin: downloading: https://raw.githubusercontent.com/Squidly271/user.scripts/master/plugins/user.scripts.plg ... done +============================================================================== | Installing new package /boot/config/plugins/user.scripts/user.scripts-2021.03.10-x86_64-1.txz +============================================================================== Verifying package user.scripts-2021.03.10-x86_64-1.txz. Unable to install /boot/config/plugins/user.scripts/user.scripts-2021.03.10-x86_64-1.txz: tar archive is corrupt (tar returned error code 2) ---------------------------------------------------- user.scripts has been installed. Copyright 2016-2020, Andrew Zawadzki Version: 2021.03.10 ---------------------------------------------------- Corrupt image.. How can i install it again? Quote Link to comment
Squid Posted May 21, 2021 Author Share Posted May 21, 2021 Delete the .txz from /config/plugins/user.scripts on the flash drive and try again Quote Link to comment
flobbr Posted May 21, 2021 Share Posted May 21, 2021 5 hours ago, Squid said: Delete the .txz from /config/plugins/user.scripts on the flash drive and try again worked flawlessly, thank you! Quote Link to comment
Jayg37 Posted May 21, 2021 Share Posted May 21, 2021 My linuxfu is lacking...i wrote a script to start and stop a bunch of docker containers in a specific order. When it's finished i would like it to close the pop up window. I tried exit and end to no avail. I don't even know what that pop up window is called to Google it. What command should i use? Quote Link to comment
Squid Posted May 21, 2021 Author Share Posted May 21, 2021 17 minutes ago, Jayg37 said: My linuxfu is lacking...i wrote a script to start and stop a bunch of docker containers in a specific order. When it's finished i would like it to close the pop up window. I tried exit and end to no avail. I don't even know what that pop up window is called to Google it. What command should i use? There is no command supported to close that window 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.