johnieutah Posted August 30, 2017 Share Posted August 30, 2017 This is a great plugin. A question about scripts with cron jobs... so I setup a "powerdown" script this morning to simply turn run powerdown at 11am. What is the process for this running? I clicked apply and then left it... do I then need to run said script in the background? Also, deleting a script with a cron job, I presume the cron job will also be taken care of? Thanks. Quote Link to comment
Squid Posted August 30, 2017 Author Share Posted August 30, 2017 22 minutes ago, johnieutah said: A question about scripts with cron jobs... so I setup a "powerdown" script this morning to simply turn run powerdown at 11am. What is the process for this running? I clicked apply and then left it... do I then need to run said script in the background? Nope. Set it and forget it 22 minutes ago, johnieutah said: Also, deleting a script with a cron job, I presume the cron job will also be taken care of? It should. I'd be surprised if I forgot to handle that situation (been awhile since I looked at the code), but if you see an update tonight, you'll know why. Quote Link to comment
johnieutah Posted August 30, 2017 Share Posted August 30, 2017 Ok, so I setup a simple script: #!/bin/bash powerdown Set-up the cron job to run the powerdown at 11am: 0 11 * * * And then hit apply. But nothing happened... anyway I can check the logs or something?! Cheers. Quote Link to comment
Squid Posted August 30, 2017 Author Share Posted August 30, 2017 (edited) 51 minutes ago, johnieutah said: Ok, so I setup a simple script: #!/bin/bash powerdown Set-up the cron job to run the powerdown at 11am: 0 11 * * * And then hit apply. But nothing happened... anyway I can check the logs or something?! Cheers. Until it runs you won't see anything. You can see the cron line added by cat /etc/cron.d/root BTW, Deleting a script won't actually delete the cron entry, but the first thing I do when executing a custom cron is to see if the script still exists and if it doesn't to immediately exit. Far simpler programming. But, anything that you do that requires you to hit the Apply button will wind up deleting the cron entry. Edited August 30, 2017 by Squid Quote Link to comment
joshuaavalon Posted September 18, 2017 Share Posted September 18, 2017 If I want custom cron schedule, is the field need to field in like "* * * * * *" for every minute? Quote Link to comment
Squid Posted September 18, 2017 Author Share Posted September 18, 2017 31 minutes ago, joshuaavalon said: If I want custom cron schedule, is the field need to field in like "* * * * * *" for every minute? Yes, but with only 5 asterisks Quote Link to comment
airbillion Posted September 19, 2017 Share Posted September 19, 2017 Hello, I have had an issue recently...when I click on the log icon to see the output from the most recent scheduled run on any of my scripts the pop up shows, but the log never shows up...it just hangs there and looks like it is waiting for my server... I can download the zip of my logs correctly, but not the recent log... Is there anything I should try to resolve this? I am on the latest 6.4 RC... Thanks!! Quote Link to comment
Squid Posted September 19, 2017 Author Share Posted September 19, 2017 Probably the same issue some users with 6.4 have with the plugin update pop up staying blank Quote Link to comment
airbillion Posted September 19, 2017 Share Posted September 19, 2017 Probably the same issue some users with 6.4 have with the plugin update pop up staying blankOk... That stinks... Is there any other way to read the logs other than downloading the zip file... It is way too large... Sent from my SM-G955U1 using Tapatalk Quote Link to comment
Squid Posted September 20, 2017 Author Share Posted September 20, 2017 If they're too big to download then you've got a different issue. Namely that your browser is choking on trying to render the entire file.Not near a computer right now but IIRC they're stored at /tmp/user.scripts/logsSent from my LG-D852 using Tapatalk because I can Quote Link to comment
airbillion Posted September 20, 2017 Share Posted September 20, 2017 If they're too big to download then you've got a different issue. Namely that your browser is choking on trying to render the entire file.Not near a computer right now but IIRC they're stored at /tmp/user.scripts/logsSent from my LG-D852 using Tapatalk because I canThanks they are located there... Yes the browser is choking on the 10mb text files for some of my script logs... Is there another location for the smaller logs? Not the zip files, but the shorter logs you can see from the user scripts plugin ....Thanks for your help!Sent from my SM-G955U1 using Tapatalk Quote Link to comment
wgstarks Posted October 1, 2017 Share Posted October 1, 2017 I see that the .DS Cleanup script has a popup window and warning about the script aborting if the window is closed. Does this mean that I can't set the script to run on a schedule? Quote Link to comment
Squid Posted October 1, 2017 Author Share Posted October 1, 2017 1 hour ago, wgstarks said: I see that the .DS Cleanup script has a popup window and warning about the script aborting if the window is closed. Does this mean that I can't set the script to run on a schedule? All scripts when run in the foreground show that. Quote Link to comment
monogoat Posted October 10, 2017 Share Posted October 10, 2017 Is there a way to make the scripts only run if they are not already running? I haven't been able to pin down a unique name from PS to add a working check into the script. I intend to use rclone to copy any new files to the local server, every 30 minutes or every hour or so. The problem is, sometimes a download might take more than that to complete, and the scripts that I use on a different system can accommodate that but I can't get it figured out here. Quote Link to comment
Squid Posted October 10, 2017 Author Share Posted October 10, 2017 Safest way would be for your script to record it's PID somewhere on start, delete the record on exit, and when starting check to see if the record exists and exit if it does. Quote Link to comment
monogoat Posted October 10, 2017 Share Posted October 10, 2017 1 hour ago, Squid said: Safest way would be for your script to record it's PID somewhere on start, delete the record on exit, and when starting check to see if the record exists and exit if it does. Good idea, shouldn't need a PID then just a file. Check for a file called running, if there exit. Then make a file called running, run script, and finally delete the file. I'm no scripting pro, does that sound right to everyone else? lol Quote Link to comment
daze Posted October 11, 2017 Share Posted October 11, 2017 7 hours ago, monogoat said: Good idea, shouldn't need a PID then just a file. Check for a file called running, if there exit. Then make a file called running, run script, and finally delete the file. I'm no scripting pro, does that sound right to everyone else? lol I was going to suggest the same. We used to call it a "file watcher" file. But saving the PID is the way it is normally done. Quote Link to comment
uldise Posted October 30, 2017 Share Posted October 30, 2017 Hi, and sorry if it was asked and answered before. i would like to run one script for many times with different input variables. are there ability to pass any variables to script? Quote Link to comment
Squid Posted October 30, 2017 Author Share Posted October 30, 2017 (edited) 43 minutes ago, uldise said: Hi, and sorry if it was asked and answered before. i would like to run one script for many times with different input variables. are there ability to pass any variables to script? https://forums.lime-technology.com/topic/48286-plugin-ca-user-scripts/?tab=comments#comment-475625 That's for running manually. For running on a schedule with different variables, you'll have to create separate scripts Edited October 30, 2017 by Squid Quote Link to comment
LSL1337 Posted November 16, 2017 Share Posted November 16, 2017 (edited) I'm a linux noob, but is it possible to write a scipt, which logs my disk status (hdparm -C /dev/sdX) (spin up/spin down) every or 15 or 60 minutes, and writes the results to a file. (maybe extend it with a HDD temp as well, maybe even fan rpm?) preferably all the results (from every different run) in the same file, or seperate disks to seperate files maybe? ( i know i can see a spin down event in the extended log, but it doesn't tell me, when a disk was spun up or down for example) thank you very much! Edited November 16, 2017 by LSL1337 Quote Link to comment
Squid Posted November 18, 2017 Author Share Posted November 18, 2017 10 hours ago, Sn3akyP3t3 said: Nit picker. Fixed Quote Link to comment
Squid Posted November 18, 2017 Author Share Posted November 18, 2017 On 11/16/2017 at 6:36 AM, LSL1337 said: I'm a linux noob, but is it possible to write a scipt, which logs my disk status (hdparm -C /dev/sdX) (spin up/spin down) every or 15 or 60 minutes, and writes the results to a file. (maybe extend it with a HDD temp as well, maybe even fan rpm?) preferably all the results (from every different run) in the same file, or seperate disks to seperate files maybe? ( i know i can see a spin down event in the extended log, but it doesn't tell me, when a disk was spun up or down for example) thank you very much! Without thinking too much: #!/bin/bash hdparm -C /dev/sdb >> /mnt/user/sharename/status.txt #change path to suit smartctl -a /dev/sdb | grep Temperature >> /mnt/user/sharename/status.txt #repeat for more disks sensors | grep Fan >> /mnt/user/sharename/status.txt And running at whatever schedule you choose. 1 Quote Link to comment
alturismo Posted November 19, 2017 Share Posted November 19, 2017 Hi, may i ask how to properly use the docker exec ... inside the script ? im hanging on that command docker exec -t apache bash ... doesnt go further then this script for example #!/bin/bash echo step 0 docker exec -t apache bash echo step 1 step 0 is the end ... im experimenting with this for auto certbot renewals inside apache docker ... but 1st i need to bypass this line for an tip thanks ahead Quote Link to comment
Squid Posted November 19, 2017 Author Share Posted November 19, 2017 4 hours ago, alturismo said: docker exec -t apache bash ... doesnt go further then this Because executing bash within a container by default means that its interactive, and the system is effectively waiting for you to enter in the commands Try this docker exec -t apache Step 0 docker exec -t apache Step 1 docker exec -t apache Step 2 1 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.