Further scripting adventures
Apr. 27th, 2016 10:25 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Documented here so that perhaps if I have to go through this whole rigamarole again, I'll at least have a starting point over the current round of *headbonk*.
Yesterday I spent an inordinate amount of time trying to figure out why I couldn't get a test script to run correctly using "while." Eventually, crying on the inside, I resorted to just typing in the whole sequence at the command line in Cygwin, and things ran just fine. So then what. Was I specifying the incorrect flavor of shell script? I ran around and looked at various variations on shell scripting. That didn't seem to be the problem. After a ridiculous period of time passed, I learned that Notepad++ for Windows is evil (explanation is basically buried in there). I rewrote the script using the vi editor and it worked. Hooray/phew.
Then, back to the matter of scheduling the script to run at a certain time. cron is almost definitely the answer, but for whatever reason I looked at a couple of other things first, before running out of time, because it looked like there were some mildly elaborate steps involved in setting up cron and there should be a simpler way for such a simple project. It seemed like "at" would be a good solution but the Cygwin command line informed me that it's deprecated and I should use "schtasks.exe" instead. Cue some more flailing around with schtasks, where eventually I got things to emit "Success!" except the test script didn't appear to run at the supposed scheduled time. Everything else pointed me at Microsoft's Task Scheduler, but I just can't get behind the notion of dealing with Microsoft GUI junk. "Click this thing in this window and then that thing in that window." Yuck.
So today I shall read some more cron setup tutorials and maybe someday soon I'll manage to schedule some overnight image collection so I can see how bad the glare is from the IR lights on the webcam at night.
Yesterday I spent an inordinate amount of time trying to figure out why I couldn't get a test script to run correctly using "while." Eventually, crying on the inside, I resorted to just typing in the whole sequence at the command line in Cygwin, and things ran just fine. So then what. Was I specifying the incorrect flavor of shell script? I ran around and looked at various variations on shell scripting. That didn't seem to be the problem. After a ridiculous period of time passed, I learned that Notepad++ for Windows is evil (explanation is basically buried in there). I rewrote the script using the vi editor and it worked. Hooray/phew.
Then, back to the matter of scheduling the script to run at a certain time. cron is almost definitely the answer, but for whatever reason I looked at a couple of other things first, before running out of time, because it looked like there were some mildly elaborate steps involved in setting up cron and there should be a simpler way for such a simple project. It seemed like "at" would be a good solution but the Cygwin command line informed me that it's deprecated and I should use "schtasks.exe" instead. Cue some more flailing around with schtasks, where eventually I got things to emit "Success!" except the test script didn't appear to run at the supposed scheduled time. Everything else pointed me at Microsoft's Task Scheduler, but I just can't get behind the notion of dealing with Microsoft GUI junk. "Click this thing in this window and then that thing in that window." Yuck.
So today I shall read some more cron setup tutorials and maybe someday soon I'll manage to schedule some overnight image collection so I can see how bad the glare is from the IR lights on the webcam at night.
no subject
Date: 2016-04-28 12:44 am (UTC)no subject
Date: 2016-04-28 12:44 am (UTC)