hernandito Posted July 13, 2016 Share Posted July 13, 2016 This is fantastic... I was doing these via my own batch script. This is much easier! Thank you Squid! A few thoughts/questions: 1) Can others share their scripts so we can incorporate into our system? 2) A little guidance for creating my own script... I have a script that executes a command inside one of my Dockers. The script goes something like: docker exec -t -i 70201386b244 cp -R /config/folderA /app/sab/folderB/ The number above is the ID of the Docker I want to access. If I re-intsall the Docker, this number changes. Is there a way to switch out the docker ID with something that will survive a Docker re-install? 3) When doing something with Dynamix Schedules, am I correct to assume that it will run in the background? Thanks, H. Quote Link to comment
hernandito Posted July 13, 2016 Share Posted July 13, 2016 For my item 2) above, when I run the script, I get me message that says: cannot enable tty mode on non tty input My script is: #!/bin/bash echo "Updating Sickrage Edits" echo "If failed, need to ensure ID of Docker is correct in the script." docker exec -t -i 70201386b244 cp -R /config/sickrage-edits/gui/slick /app/sickrage/gui/ How can I fix this? Thanks, H. Quote Link to comment
wgstarks Posted July 13, 2016 Share Posted July 13, 2016 1) Can others share their scripts so we can incorporate into our system? Great idea. Maybe in a seperate thread though. Quote Link to comment
Squid Posted July 13, 2016 Author Share Posted July 13, 2016 For my item 2) above, when I run the script, I get me message that says: cannot enable tty mode on non tty input My script is: #!/bin/bash echo "Updating Sickrage Edits" echo "If failed, need to ensure ID of Docker is correct in the script." docker exec -t -i 70201386b244 cp -R /config/sickrage-edits/gui/slick /app/sickrage/gui/ How can I fix this? Thanks, H. Not the expert on docker exec but I think it's because you're running it in interactive mode -i and it recognizes there is no console input. Try removing that switch Sent from my LG-D852 using Tapatalk Quote Link to comment
Squid Posted July 13, 2016 Author Share Posted July 13, 2016 This is fantastic... I was doing these via my own batch script. This is much easier! Thank you Squid! A few thoughts/questions: 1) Can others share their scripts so we can incorporate into our system? 2) A little guidance for creating my own script... I have a script that executes a command inside one of my Dockers. The script goes something like: docker exec -t -i 70201386b244 cp -R /config/folderA /app/sab/folderB/ The number above is the ID of the Docker I want to access. If I re-intsall the Docker, this number changes. Is there a way to switch out the docker ID with something that will survive a Docker re-install? 3) When doing something with Dynamix Schedules, am I correct to assume that it will run in the background? Thanks, H. 1 just post it. 2 yeah I guess in case of a install reinstall or an update through dockerMan the id can change. I'll bang together a script you can call with the name and it will return the id 3 anything scheduled to run here uses dynamix schedules. Scripts all run in the background and if there are multiple scheduled they will run concurrently Sent from my LG-D852 using Tapatalk Quote Link to comment
saarg Posted July 13, 2016 Share Posted July 13, 2016 This is fantastic... I was doing these via my own batch script. This is much easier! Thank you Squid! A few thoughts/questions: 1) Can others share their scripts so we can incorporate into our system? 2) A little guidance for creating my own script... I have a script that executes a command inside one of my Dockers. The script goes something like: docker exec -t -i 70201386b244 cp -R /config/folderA /app/sab/folderB/ The number above is the ID of the Docker I want to access. If I re-intsall the Docker, this number changes. Is there a way to switch out the docker ID with something that will survive a Docker re-install? 3) When doing something with Dynamix Schedules, am I correct to assume that it will run in the background? Thanks, H. 1 just post it. 2 yeah I guess in case of a install reinstall or an update through dockerMan the id can change. I'll bang together a script you can call with the name and it will return the id 3 anything scheduled to run here uses dynamix schedules. Scripts all run in the background and if there are multiple scheduled they will run concurrently Sent from my LG-D852 using Tapatalk Can't you just use the name of the container? That is what I do when I run a docker exec. Quote Link to comment
Squid Posted July 13, 2016 Author Share Posted July 13, 2016 You guys would know better than I. All I ever do with the various plugins is communicate with dockerman Sent from my LG-D852 using Tapatalk Quote Link to comment
hernandito Posted July 13, 2016 Share Posted July 13, 2016 Can't you just use the name of the container? That is what I do when I run a docker exec. Saarg... I cant believe it was as simple as that. Just tried it and it worked. Thank you. Quote Link to comment
hernandito Posted July 13, 2016 Share Posted July 13, 2016 1 just post it. 2 yeah I guess in case of a install reinstall or an update through dockerMan the id can change. I'll bang together a script you can call with the name and it will return the id 3 anything scheduled to run here uses dynamix schedules. Scripts all run in the background and if there are multiple scheduled they will run concurrently Sent from my LG-D852 using Tapatalk Thank you Squid... The Docker ID is not needed per Saarg... Removing the -i fixed the problem as well in my script. Thank you very much!! Quote Link to comment
hernandito Posted July 13, 2016 Share Posted July 13, 2016 moved to script sample thread: http://lime-technology.com/forum/index.php?topic=50416.0 Quote Link to comment
Squid Posted July 17, 2016 Author Share Posted July 17, 2016 1) Can others share their scripts so we can incorporate into our system? Great idea. Maybe in a seperate thread though. I've created a separate thread for this HERE Quote Link to comment
thomast_88 Posted August 14, 2016 Share Posted August 14, 2016 Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/ Quote Link to comment
saarg Posted August 14, 2016 Share Posted August 14, 2016 Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/ But if you already have the power down plugin, why is the script plugin involved? Quote Link to comment
Squid Posted August 14, 2016 Author Share Posted August 14, 2016 Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/ But if you already have the power down plugin, why is the script plugin involved? Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions) Will add in array start and array stop to the frequency options. Should take about 10 minutes for me tonight.... Quote Link to comment
thomast_88 Posted August 14, 2016 Share Posted August 14, 2016 Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/ But if you already have the power down plugin, why is the script plugin involved? Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions) Will add in array start and array stop to the frequency options. Should take about 10 minutes for me tonight.... Exactly. This script is about not having to touch the command line. Sounds good, will try it out when it's updated :-) Quote Link to comment
saarg Posted August 14, 2016 Share Posted August 14, 2016 Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/ But if you already have the power down plugin, why is the script plugin involved? Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions) Will add in array start and array stop to the frequency options. Should take about 10 minutes for me tonight.... Exactly. This script is about not having to touch the command line. Sounds good, will try it out when it's updated :-) Ahh... You're one of those guys Quote Link to comment
Squid Posted August 14, 2016 Author Share Posted August 14, 2016 Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/ But if you already have the power down plugin, why is the script plugin involved? Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions) Will add in array start and array stop to the frequency options. Should take about 10 minutes for me tonight.... Exactly. This script is about not having to touch the command line. Sounds good, will try it out when it's updated :-) Ahh... You're one of those guys So you must miss 6.0B6 with no dockerMan, and strictly docker run commands then Quote Link to comment
JorgeB Posted August 14, 2016 Share Posted August 14, 2016 I'm trying to make a very basic script for one of my servers, and wonder if anyone can help as I'm clueless with them. This is the scrip I need: 1-run mover 2-trim cache 3-check for array inactivity (monitor reads/writes?), if inactive for say 60 seconds go to 4 4-powerdown 1,2 and 4 are easy, any ideas how I can do 3? Quote Link to comment
Squid Posted August 14, 2016 Author Share Posted August 14, 2016 I'm trying to make a very basic script for one of my servers, and wonder if anyone can help as I'm clueless with them. This is the scrip I need: 1-run mover 2-trim cache 3-check for array inactivity (monitor reads/writes?), if inactive for say 60 seconds go to 4 4-powerdown 1,2 and 4 are easy, any ideas how I can do 3? Easy way for 3 is to check if all the disks are spun down: ie the "color" is green-blink for all the disks within /var/local/emhttp/disks.ini More or less implies no activity. (alternatively, use hdparm to check) To do it the way that you want is to check each disks numReads and numWrites (once again within disks.ini), sleep for 60 seconds, and then check again. If all the values are the same, then go to 4. I can bang together a php script later if it'll help (with a return code you can check) -> hate doing stuff like this in bash. Quote Link to comment
JorgeB Posted August 14, 2016 Share Posted August 14, 2016 Easy way for 3 is to check if all the disks are spun down: ie the "color" is green-blink for all the disks within /var/local/emhttp/disks.ini More or less implies no activity. (alternatively, use hdparm to check) Thanks, the easy way would work for me, but like I said I'm totally clueless with scripts, how do I add a line to check if they're all spun down? This is my current script: /usr/local/sbin/mover /sbin/fstrim -v /mnt/cache /usr/bin/sleep 180 /usr/local/sbin/powerdown I'd like to replace the sleep line with the check for spun down disks. Quote Link to comment
Squid Posted August 14, 2016 Author Share Posted August 14, 2016 lol sure.. catch me as I'm doing the numReads / Writes version. Gimme a couple min. Assuming you want to exclude cache drive Quote Link to comment
JorgeB Posted August 14, 2016 Share Posted August 14, 2016 lol sure.. catch me as I'm doing the numReads / Writes version. Gimme a couple min. Assuming you want to exclude cache drive If you're doing the other one I would still prefer it, avoids the server being on for an extra 15 minutes unnecessarily, the least you can set to spin down. Quote Link to comment
Squid Posted August 14, 2016 Author Share Posted August 14, 2016 lol sure right when I finish the easy version. Gotta eat and spend time with the wife. I'll get back to it in a bit #!/usr/bin/php <?PHP function startsWith($haystack, $needle) { return $needle === "" || strripos($haystack, $needle, -strlen($haystack)) !== FALSE; } exec("/usr/local/sbin/mover"); exec("/sbin/fstrim -v /mnt/cache"); $disks = parse_ini_file("/var/local/emhttp/disks.ini",true); foreach ($disks as $disk) { if ( startsWith($disk['name'],"cache") ) { continue; } if ( $disk['name'] == "flash" ) { continue; } if ( (! strpos($disk['color'],"blink")) && (!strpos($disk['color'],"off")) ) { $flag = true; } } if ( ! $flag ) { exec("/usr/local/sbin/powerdown"); } ?> Quote Link to comment
Squid Posted August 14, 2016 Author Share Posted August 14, 2016 Problem with the other method in quick testing is that tuneable (poll_attributes) has to be set to be less than whatever the sleep is for since disks.ini is only updated at that frequency. I believe that spin downs take effect in disks.ini immediately. Quote Link to comment
JorgeB Posted August 14, 2016 Share Posted August 14, 2016 lol sure right when I finish the easy version. Gotta eat and spend time with the wife. I'll get back to it in a bit Thanks! No rush, I'll try this one tomorrow. 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.