Posts

Showing posts with the label MacOS

Adding Verbal Warnings and Time Quotas Configurable by Account for Forced Logouts in Programmatic MacOS Parental Controls

Building upon the original Restoring Forced Logouts Removed from MacOS Parental Controls , the original refinements , and the New Year updates to them, I have since added code to add the following features. Give two verbal warnings about (approximate) time remaining before forced logout; and Make the minutes allowed per day a configurable property which can be customized for individual accounts. The first was added as a courtesy to our boys. The second was added to allow cutting back or eliminating hours for each boy individually if they didn't complete their list of basic daily tasks to be done to be allowed the full amount of computer time for the following day, or to increase it for sick days and the like. Making it a property also allows changing it on the fly, without having to alter the code, and also eliminates some very inconvenient hard-coded values. The properties were added to the end of the application.properties file. At the same time, I added a missing J...

Further New Year Updates for Forced Logouts in Programmatic MacOS Parental Controls

Early this January, 2022, Sara and I noticed that it seemed like the boys could stay on the computer much longer than what the forced time quotas my refined program enforced. Investigating the code revealed something I should have anticipated, having been part of a " Y2K readiness team" earlier in my career. The problem was that my "UserLoginTime" objects were obtained given the output from the bash shell's "who" command, which only shows the login time for users using a two-digit month and two-digit day, but no year. When I constructed UserLoginTimes that were holdovers from old logins at the end of December 2021, the code was assuming that it was December of the current year - nearly a year in  the future. So, when checking whether the total time online for the boys was greater than the specified value, the code was subtracting a future date and time from the current date and time, resulting in a negative "elapsed time", thus never timi...

Refining Forced Logouts in Programmatic MacOS Parental Controls

It did not take long for the more math- and computer-oriented of our twin sons to figure out the loophole I mentioned at the end of my original post, " Restoring Forced Logouts Removed from MacOS Parental Controls ": Crafty minds can probably already spot one loophole with how this works. The kids will only get logged out from their current session if the current session has been an hour or more. There is nothing checking their usage for the day. So, if they want to get the most time, they could log in for, say, 50 minutes, and then log in a few minutes later for another 50 minutes or so, and so forth. The fix will involve a more complex refinement. I think I will need to create a small database of total minutes logged in per day and user (for the monitored kids, not the adults), and add 5 minutes for every time they show up as being logged in by the every-5-minute-run of LogTimerApp. Then, if the total time for the day hits the hour limit, then do the logout. So, I ...

Restoring Cron Job Functionality in MacOS

I have used cron jobs to do database backups and other maintenance on servers I have run at home, previously on versions of Ubuntu and Linux Mint, and currently on MacOS. Some change that happened to MacOS between the "Mojave" and "Big Sur" versions broke cron jobs that had worked for years. A cron job that would create a database restore query was suddenly creating an empty file on its daily scheduled run. The job that was supposed to update my SSL certificate when it was due for renewal never succeeded in updating it. As I searched for a solution to this problem, I came across multiple recommendations for two different items, and the combination of the two of them has resulted in my cron jobs working again. Make sure the full path is specified for all programs and script files executed, both within the cron job itself, and within the script files that it calls. This is probably the true solution, of the two items. Make sure that cron has "Full Disk ...

Restoring Forced Logouts Removed from MacOS Parental Controls

At some point between the release of MacOS "Mojave" and MacOS "Big Sur", one of the key features that I liked about the parental controls — the ability to force logouts from the Mac after the time quota for the day was met — was removed. This is my least favorite removal of a previous feature of the Mac operating system since the removal of the photo mosaic screen saver with the change from Lion to Mountain Lion (see this old video for an example of what it used to look like). While I know the focus now is on screen time specific to various apps across all devices, we really only have the one Mac that our boys use and which we want to limit their time on, and we don't want them to use up their allotted hour on, say, Minecraft, and then spend another hour browsing YouTube videos in a web browser. Since I could not find any way to force logouts after a time using the current "Screen Time" settings in MacOS Big Sur, I decided I would have to come up wi...

Fixing "Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib\n Referenced from: /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so\n Reason: image not found" after a php Update on a Mac

A few weeks ago, I discovered the Wordpress "Site Health Status" tool. I saw that it recommended upgrading my outdated version of php so, being a good "computer guy", I went ahead and did the upgrade. After the update, I found that I could not view my website. After digging around to remind myself about the sudo apachectl -k restart command, I got the error message httpd: Syntax error on line 183 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so into server: dlopen(/usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so, 10): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib\n Referenced from: /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so\n Reason: image not found Since I use the Homebrew package manager, I followed the advice to do a brew upgrade brew cleanup However, even after doing this, I found I still had the problem. Trying other advice, I tried reinstalling php, and saw advice...

Fixing ERR_CONNECTION_REFUSED errors attempting to connect to my site after changes

After upgrading(?) my Mac to MacOS Mojave, I found the hard disk access speed intolerable. Boot ups would take several minutes, and everything took far too long. I finally switched my Mac to boot up off of an external USB Solid State Drive (SSD). After cloning my hard drive to the SSD and switching it to be the default boot drive, the old(ish) Mac is once again pleasantly fast and usable. However, after this change, I found that, whenever I attempted to connect to my site, any browser I tried to connect to it through would give a message about being unable to connect to the server. One specific message shown in Google Chrome was ERR_CONNECTION_REFUSED The first part of the solution came from a Stack Overflow answer by adang . In a terminal, I ran sudo vi /etc/apache2/httpd.conf I then uncommented the following lines by removing the pound ("#") at the start of the line containing them: LoadModule authz_core_module libexec/apache2/mod_authz_core.s...