tschinz Posted March 11, 2021 Share Posted March 11, 2021 2 hours ago, ICDeadPpl said: Put 'bash' in front of the command. Like 'bash /boot/config/plugins/user.scripts/scripts/backup_onedrive/script' Thanks ICDeadPpl, that worked. I've in one main script multiple sub user scripts I would like to launch. Is it possible to wait for one command to finish before launching the next? Currently both are started at the same time because of the "at now" command. I there a method to launch the second after the first is finished. Thanks for the help Quote Link to comment
Marcel40625 Posted March 11, 2021 Share Posted March 11, 2021 25 minutes ago, tschinz said: Thanks ICDeadPpl, that worked. I've in one main script multiple sub user scripts I would like to launch. Is it possible to wait for one command to finish before launching the next? Currently both are started at the same time because of the "at now" command. I there a method to launch the second after the first is finished. Thanks for the help just do everything in one script, dont think there is a easy way. you could save a text file in the sub-scripts and wait for the file to appear in the main script Quote Link to comment
ICDeadPpl Posted March 11, 2021 Share Posted March 11, 2021 3 hours ago, Marcel40625 said: Hey there, i would like to know how i can mail the whole output of rsync -av --delete --ignore-errors -e as notification thanks in advance You could call '/usr/local/emhttp/webGui/scripts/notify' from your script, and have the message include the output of the rsync job. The rsync output could be temporarily stored as a file, piped argument, named pipe or whatever. Run the command '/usr/local/emhttp/webGui/scripts/notify' once without any arguments to see which there are for you to use. You may want to check the notifications in Unradid Web UI "Settings/Notifications settings" so they are set to send email. Quote Link to comment
tschinz Posted March 11, 2021 Share Posted March 11, 2021 3 hours ago, Marcel40625 said: Hey there, i would like to know how i can mail the whole output of rsync -av --delete --ignore-errors -e as notification thanks in advance with the at command you can get an email command | at now Quote Link to comment
Marcel40625 Posted March 11, 2021 Share Posted March 11, 2021 10 minutes ago, ICDeadPpl said: You could call '/usr/local/emhttp/webGui/scripts/notify' from your script, and have the message include the output of the rsync job. The rsync output could be temporarily stored as a file, piped argument, named pipe or whatever. Run the command '/usr/local/emhttp/webGui/scripts/notify' once without any arguments to see which there are for you to use. You may want to check the notifications in Unradid Web UI "Settings/Notifications settings" so they are set to send email. yeah but how can i attach the file or output from rsync to the notify command /usr/local/emhttp/webGui/scripts/notify -i normal -s "Test" -d "Test" -m < test.txt does not work the content of the file is not showing in notification Quote Link to comment
ICDeadPpl Posted March 11, 2021 Share Posted March 11, 2021 2 minutes ago, Marcel40625 said: yeah but how can i attach the file or output from rsync to the notify command /usr/local/emhttp/webGui/scripts/notify -i normal -s "Test" -d "Test" -m < test.txt does not work the content of the file is not showing in notification Try MESSAGE=`rsync -av --delete --ignore-errors -e` /usr/local/emhttp/webGui/scripts/notify -i normal -s "Test" -d "Test" -m "$MESSAGE" Quote Link to comment
Marcel40625 Posted March 11, 2021 Share Posted March 11, 2021 51 minutes ago, ICDeadPpl said: Try MESSAGE=`rsync -av --delete --ignore-errors -e` /usr/local/emhttp/webGui/scripts/notify -i normal -s "Test" -d "Test" -m "$MESSAGE" thanks, but found out tail works /usr/local/emhttp/webGui/scripts/notify -i normal -s "Test" -d "Test" -m "`tail logfile.log`" Quote Link to comment
Squid Posted March 11, 2021 Author Share Posted March 11, 2021 3 minutes ago, Marcel40625 said: thanks, but found out tail works One problem with all of this is that IF there's a double quote within the output of the tail then you'll either get weird results in the message, or the notify command itself will fail. Quote Link to comment
Marcel40625 Posted March 11, 2021 Share Posted March 11, 2021 (edited) 13 minutes ago, Squid said: One problem with all of this is that IF there's a double quote within the output of the tail then you'll either get weird results in the message, or the notify command itself will fail. thanks for the advice, but seems to work in this case and doesnt help ` ` for that? Edited March 11, 2021 by Marcel40625 Quote Link to comment
ajstaley33 Posted March 16, 2021 Share Posted March 16, 2021 when i set my script to run daily what time will it run? Quote Link to comment
tutu Posted March 16, 2021 Share Posted March 16, 2021 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 ---------------------------------------------------- plugin: user.scripts.plg installed what is the problem when I install this plugin...pls help, thx what is the problem when I install this plugin...pls help, thx what is the problem when I install this plugin...pls help, thx a lot Quote Link to comment
Squid Posted March 16, 2021 Author Share Posted March 16, 2021 Try again. Nothing wrong with that archive its trying to download. Quote Link to comment
wgstarks Posted March 16, 2021 Share Posted March 16, 2021 4 hours ago, ajstaley33 said: when i set my script to run daily what time will it run? IIRC it will use the daily schedule set in Scheduler. Quote Link to comment
Squid Posted March 16, 2021 Author Share Posted March 16, 2021 4 minutes ago, wgstarks said: IIRC it will use the daily schedule set in Scheduler. Adjustable if you have The Schedules plugin installed Quote Link to comment
ProphetSe7en Posted March 25, 2021 Share Posted March 25, 2021 I am looking for a script that does the following: - check if cache is more than 60% ful - If so, then pause/stop all torrents in rtorrent and start mover - if cache is less than 60% full do nothing Anyone got a script like this? Quote Link to comment
mattie112 Posted March 28, 2021 Share Posted March 28, 2021 On 3/25/2021 at 5:33 PM, ProphetSe7en said: I am looking for a script that does the following: - check if cache is more than 60% ful - If so, then pause/stop all torrents in rtorrent and start mover - if cache is less than 60% full do nothing Anyone got a script like this? Quote Link to comment
ProphetSe7en Posted April 6, 2021 Share Posted April 6, 2021 Thanks. That covers one part of want I want. Still need to figure out how to stop/pause all torrents and then restart them after mover is done Quote Link to comment
Cessquill Posted April 6, 2021 Share Posted April 6, 2021 11 minutes ago, ProphetSe7en said: Thanks. That covers one part of want I want. Still need to figure out how to stop/pause all torrents and then restart them after mover is done Without delving into whether it's possible to interact with rtorrent at that level, can't you just stop and start the docker with "docker stop <name-of-container>" and "docker start <name-of-container>" commands? Quote Link to comment
ProphetSe7en Posted April 6, 2021 Share Posted April 6, 2021 Probably, but stopping a torrent container can cause problems if a torrent is during dl or recently finished and no session has been saved the last 20 minutes. So I prefere to sett all active torrents in a pause state, run mover then resume all torrents Quote Link to comment
Cessquill Posted April 6, 2021 Share Posted April 6, 2021 29 minutes ago, ProphetSe7en said: Probably, but stopping a torrent container can cause problems if a torrent is during dl or recently finished and no session has been saved the last 20 minutes. So I prefere to sett all active torrents in a pause state, run mover then resume all torrents docker pause <name-of-container> / docker unpause <name-of-container> then? Quote Link to comment
ProphetSe7en Posted April 6, 2021 Share Posted April 6, 2021 (edited) Hmm. That might work, need to test it first Do you know if it is possible to issue the pause command only if cache is >60% full? No need to pause the container if mover wont run because of cache drive is less the 60% full. I know mover can be started using script, and from mover settings it wont run if cache is less than 60%. But while doing this with a script it will cause rtorrent to pause/resume each time the script runs regardless of mover will be running or not Edit: So I need to add the pause & unpause command to the mover script? Clearly the "docker pause/unpause rtorrentvpn" wont work like this, but what format should it be in to work? if ( $percent > $moveAt ) { docker pause rtorrentvpn; exec("/usr/local/sbin/mover"); docker unpause rtorrentvpn; } Edited April 6, 2021 by ProphetSe7en Quote Link to comment
Cessquill Posted April 6, 2021 Share Posted April 6, 2021 1 hour ago, ProphetSe7en said: Clearly the "docker pause/unpause rtorrentvpn" wont work like this, but what format should it be in to work? I'm not at my machine at the moment, but somebody else would know better. Your script would pause the docker (assuming that's the correct name), but I'm guessing it would unpause it straight away. You'd need a second part to the script in an else block that checks if docker is paused and whether the mover is running. If the mover has finished, unpause. Something like... if ( $percent > $moveAt ) { docker pause rtorrentvpn; exec("/usr/local/sbin/mover"); } else { if (!moverRunning && dockerIsPaused) { docker unpause rtorrentvpn; } } ...although without researching I don't know how to check if the mover is running and a docker is paused - this is just to illustrate the concept. Quote Link to comment
ProphetSe7en Posted April 6, 2021 Share Posted April 6, 2021 6 hours ago, Cessquill said: I'm not at my machine at the moment, but somebody else would know better. Your script would pause the docker (assuming that's the correct name), but I'm guessing it would unpause it straight away. You'd need a second part to the script in an else block that checks if docker is paused and whether the mover is running. If the mover has finished, unpause. Something like... Hmm. I thought if I put the command under the "if" part of that script it would only be issued if the cache disk is >xx% ful, like the mover would in the script? Maybe I am mistaken, but in this script everything under "if" only runs if the disk threshold is met? #!/usr/bin/php <?PHP $moveAt = 70; # Adjust this value to suit. $diskTotal = disk_total_space("/mnt/cache"); $diskFree = disk_free_space("/mnt/cache"); $percent = ($diskTotal - $diskFree) / $diskTotal * 100; if ( $percent > $moveAt ) { exec("/usr/local/sbin/mover"); } ?> So I need to figure out on how to combine the script above with these commands. docker exec comand mover && docker exec comand (when mover is finished) Not very elegant, but can I replace exec("/usr/local/sbin/mover"); with exec("/mnt/user/various/unRaid/script/mover.sh); Then in the mover.sh I have the docker exec (command to pause all torrents) mover && docker exec (command to start all torrents) I get it to work, but then I dont have the threshold part in place. Quote Link to comment
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
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.