So a few months ago, closing in on 3,000 posts, the database got too big and krypted.com started suffering from innodb corruption, resulting in database outages. While I was able to get the site up, it was using a read-only database that kept me from doing any new articles or updates. It was a strange time in my life, like suddenly being single after living with someone since Y2K (when I started the site). But I got through it and was able to repair the relation… er, site. Now, with a new database that is free from corruption we’re ready to get to 6,000 posts! Also, I had a little…
-
-
Command Line Firewall Management In OS X 10.10
The tools to automate OS X firewall events from the command line are still stored in /usr/libexec/ApplicationFirewall. And you will still use socketfilterfw there for much of the heavy lifting. However, now there are much more helpful and functional options in socketfilterfw that will allow you to more easily script the firewall. Some tricks I’ve picked up with the Mac Firewall/alf scripting: Configure the firewall fully before turning it on (especially if you’re doing so through something like Casper, FileWave, Munki, or Absolute Manage where you might kick yourself out of your session otherwise). Whatever you do, you can always reset things back to defaults by removing the com.apple.alf.plist file…
-
Don’t Use bless To Change Startup Disks Any More In OS X
For a long time, we used the bless command to startup systems to a specific volume in OS X. Back in 2009 I started using the systemsetup command for more and more tasks. These days, I’m being guided to replace all of my bless options in scripts to systemsetup. The easy way to configure your startup volumes using systemsetup is to list the available volumes, set one as the startup volume and then check to see which one is the current volume. The first task is to list the available startup volumes, using the -liststartupdisks option: sudo systemsetup -liststartupdisks You can then set the disk as one that was listed…
-
Create 10,000 Empty Directories for Testing
The mkdir command is used to create directories. Sometimes, in testing, you need to have a lot of directories. So, you can use the following command to create 10,000 5 digit directories, named 00001 to 10000: mkdir $(printf '%05d\n' {1..10000})
-
Using odutil with opendirectoryd
The options for Open Directory continue to get more refined, aligning with opendirectoryd. The odutil command is becoming more and more useful with each version of OS X. Let’s inspect the directory service cache, using odutil with the show verb and the cache option: odutil show cache You can also view statistics for opendirectoryd using that show verb but with the statistics option: odutil show statistics And to see everything, use odutil with the show verb and the all option to get plenty of data to grep through: odutil show all The final show option we’ll look at is configuration. Here, you will also need to feed a directory nodename…
-
Bypass the Application Downloaded From the Internet Warning in OS X
___ “is an application downloaded from the Internet. Are you sure you want to open it?” is a warning dialog that appears when you open an application that you downloaded from the Internet. When you install those software titles with automation, you can clear the attribute that causes the prompt, so you don’t get a lot of confusion from end users. TO do so, use the xattr command, using -d to delete the com.apple.quarantine attribute. Here, we’re going to do so recursively, using the -r option and finally defining the application: sudo xattr -d -r com.apple.quarantine /Applications/iExplorer.app
-
Unix Signals
When you run a kill command to stop a process from bash or the javax.realtime.POSIXSignalHandler class, you’re sending what’s known as a POSIX signal to the process. These signals can be called via their numeric representations or the signal (e.g. with the -s option of the kill command). Signals include the following: 1: SIGHUP – Close the controlling terminal when the controlling process dies 2: SIGINT – Send a keyboard interrupt 3: SIGQUIT – Quit from a keyboard/terminal 4: SIGILL – Terminate illegal instruction with a core dump and don’t restart 5: SIGTRAP – Send a trace/break trap (with core dump) 6: SIGABRT – Process an abort signal 7: SIGEMT…
-
More Command Line Service Control In OS X
The serverctl command can be used to start and stop services in OS X Server. Use serverctl with a list verb to show a list of services: serverctl list Grab a service (without the quotes) and feed it back into serverctl with the enable option and a service= option to identify the service: serverctl enable service=com.apple.servermgrd.xcode Or disable, using the disable verb: serverctl disable service=com.apple.servermgrd.xcode
-
Restart Macs Down Immediately in OS X
You can shut (and restart) Macs down immediately using the shutdown command. To do so, run the following command: shutdown -r now
-
Use the textutil Command To Query Office Files For Metadata
You can use the textutil command to pull metadata information from Office documents. Here, we’ll use the -info option to do so: textutil -info hello.docx The output would be as follows: It might display: Type: Word format Size: 44068 bytes Length: 4234 characters Title: Author: Charles Edge Last Editor: Charles Edge Subject: Keywords: Created: 2015-06-28 08:21:00 -0900 Last Modified: 2015-06-28 10:02:00 -1200 Contents: Hello world