I have an old 2010 MBA which runs High Sierra. It is located at a condo which I visit for a few days each month. The machine runs 24/7 mostly to upload webcam photos to a host every four minutes, to assemble and upload a time-lapse video every 24 hours and to perform routine maintenance tasks. Here is the webcam page: Cha Am Cam
All of this is done with bash shell scripts that are run via launchd with the help of Lingon.
When I arrived last week I discovered that the USB camera had failed because the housekeeper who had cleaned the place just before our arrival had crushed the USB cable when she locked the balcony door. I ordered a new cable which took a few days to arrive from Bangkok.
After I received the new USB cable, the images produces by the webcam were highly variable. Some were 100% black and others were 100% white. Others were horribly washed out. Sometimes the binary which grabs the images, imagesnap, would become non-responsive. I tried to fix the latter problem using timeout. That seemed to work. Oddly, as time passed, the images produced by the camera steadily improved. No more all-black or all-white images. The exposure on the useable images also normalized. After a day, everything was back to normal. Can a digital camera heal itself? (Rhetorical question.)
One morning, after observing a string of successful image grabs and uploads, I hopped on my bicycle and went out for coffee. When I got back I was shocked to see that about a half hour after I left the uploads stopped. In fact, the machine had stopped grabbing images at all. A little checking revealed that launchd was refusing to run the image capture and upload script with error 78 - Function Not Implemented. How helpful. Odd, because the script ran fine from the command line.
I figured that some change that I made to the script must have caused this. But, if so, how did it continue to run for half an hour or so after I'd left for coffee? I poured over the script and could find nothing obvious. I happened to have a backup of all scripts that I made last December. I copied the backup script to the MBA and it started to run right away.
I made the same edits to the backup script as I had made to the original. The script continued to run with no problems. Mystery.
The next morning I checked to see if the video upload worked. It did not. Same launchd error: 78 - Function Not Implemented. Now, this is a script that has run, unchanged, as it is, once a day for several years. Almost never fails and when I does it's always due to a network error.
So, I copied the absolutely identical backup and, voila, it ran just fine. Mystery.
I decided to check some other scripts. I found about six that also started failing to run at the same time as the image capture and upload script. These are all simple scripts that run regularly and have done so, without change, for years. Why did they all suddenly stop and all about the same time all due to the same launchd error? Why were other scripts not affected?
I copied over the backups of all the failing scripts and they all ran with no problems.
I'd love to have an explanation as to how this happened and what I can do to prevent it from happening again.
All of this is done with bash shell scripts that are run via launchd with the help of Lingon.
When I arrived last week I discovered that the USB camera had failed because the housekeeper who had cleaned the place just before our arrival had crushed the USB cable when she locked the balcony door. I ordered a new cable which took a few days to arrive from Bangkok.
After I received the new USB cable, the images produces by the webcam were highly variable. Some were 100% black and others were 100% white. Others were horribly washed out. Sometimes the binary which grabs the images, imagesnap, would become non-responsive. I tried to fix the latter problem using timeout. That seemed to work. Oddly, as time passed, the images produced by the camera steadily improved. No more all-black or all-white images. The exposure on the useable images also normalized. After a day, everything was back to normal. Can a digital camera heal itself? (Rhetorical question.)
One morning, after observing a string of successful image grabs and uploads, I hopped on my bicycle and went out for coffee. When I got back I was shocked to see that about a half hour after I left the uploads stopped. In fact, the machine had stopped grabbing images at all. A little checking revealed that launchd was refusing to run the image capture and upload script with error 78 - Function Not Implemented. How helpful. Odd, because the script ran fine from the command line.
I figured that some change that I made to the script must have caused this. But, if so, how did it continue to run for half an hour or so after I'd left for coffee? I poured over the script and could find nothing obvious. I happened to have a backup of all scripts that I made last December. I copied the backup script to the MBA and it started to run right away.
I made the same edits to the backup script as I had made to the original. The script continued to run with no problems. Mystery.
The next morning I checked to see if the video upload worked. It did not. Same launchd error: 78 - Function Not Implemented. Now, this is a script that has run, unchanged, as it is, once a day for several years. Almost never fails and when I does it's always due to a network error.
So, I copied the absolutely identical backup and, voila, it ran just fine. Mystery.
I decided to check some other scripts. I found about six that also started failing to run at the same time as the image capture and upload script. These are all simple scripts that run regularly and have done so, without change, for years. Why did they all suddenly stop and all about the same time all due to the same launchd error? Why were other scripts not affected?
I copied over the backups of all the failing scripts and they all ran with no problems.
I'd love to have an explanation as to how this happened and what I can do to prevent it from happening again.