Cursor Tracking Lag Caused by system_profiler
Posted: May 5, 2013 Filed under: Hardware, Mac OS X, Scripting, Uncategorized, Unix | Tags: cursor, display, inventory, jumps, jumpy, lag, mouse, system_profiler, thunderbolt 3 Comments »We’ve noticed problems with mouse cursor tracking, on Thunderbolt Macs attached to displays.
In the middle of moving the cursor with mouse or trackpad, the cursor jumps or skips making it difficult to control.
We tracked down the problem to background runs of system_profiler. Specifically, when system_profiler queries the display for information.
Running system_profiler without flags or with the SPDisplaysDataType data type triggers the problem.
To reproduce the problem at its worst, run the following in Terminal on a Thunderbolt Mac attached to a display and attempt to use the tracking device:
while [ 1 ]; do system_profiler SPDisplaysDataType; done
Apple is aware of the issue, but has stated that this is expected behavior.
Many tools that rely on system_profiler trigger the issue including JAMF Casper Suite, Puppet, and Apple Remote Desktop. These and other tools routinely inventory the Mac using system_profiler.
There is currently no workaround for getting display information such as Display serial number. And the only way to avoid the trigger is to run system profiler with each data type excluding SPDisplaysDataType.
If you think Apple should address the issue, please let them know.
Testing WebDAV uploads with curl
Posted: September 14, 2012 Filed under: Uncategorized | Tags: curl, put, test, upload, webdav Leave a comment »Pretty simple, but handy.
curl -X PUT –trace-ascii – -T /path/to/file/to/upload http://thewebdavhost.com/webdirectory/remotefilename
Note that a PUT will overwrite an existing file.
Unattended Install of Mac Package that requires a Logged in User
Posted: August 26, 2012 Filed under: Deployment, Mac OS X, Scripting, Uncategorized | Tags: automatically, bash, force, install, kcpassword, login, mac, osx, package, pkg, script, user 1 Comment »Once in a while you run into a package or program that will only work properly with a user logged in. This can ruin your day if you need to automated the deployment.
I found this method of automatically logging in a user (which is quite awesome).
Using that perl script along with a wrapper script can enable you to automate these can other cases where your only option is to have a user logged in.
I started writing a script to handle this, but it turned out I didn’t need it. The script is unfinished, but it may give you a head start if you are considering something similar.
It depends on a modified version of the perl script that accepts a username and password. Just swap out the user and password lines with these that accept arguments.
my $user = $ARGV[0];
my $pass = $ARGV[1];
and I comment out the line to automatically restarts the loginwindow.
#system(‘killall’,'loginwindow’);
Tips for writing command line tools in ruby
Posted: August 2, 2011 Filed under: Mac OS X, Ruby, Scripting, Uncategorized, Unix | Tags: command line, development, exit status, file extension, irb, load, option parsing, require, require ruby file without extension, Ruby, tool Leave a comment »- Option parsing: Read this article by Allen Wei on RubyLearning Blog for a great overview. I recommend sticking with the built-in OptionParser if you want to reduce dependencies.
- If you want your code to be loadable so you can access functions and classes in the irb console for testing, use the following pattern:
def main#option parsing and execution code hereendif __FILE__ == $0main()endThis way the main function will only be automatically called if the script is being executed on the command line.
And in irb, you can call your functions and classes as you see fit for testing without triggering your whole script to run.Note that this is similar to the python __main__ test if you are coming from a python background.
- Naming without ruby’s.rb extension: You can name your executable without the rb extension if you wish, just be sure to include your shebang (#!)
To use the user’s default ruby, use:
#!/usr/bin/env ruby
But in some cases you may want the specify the path to ruby so you can use macruby or rubycocoa if you are need those frameworks to be available
#!/usr/bin/ruby
When testing in irb,
require 'script-name'
won’t work without the rb extension, but
load 'script-name'
does work. - Use exit codes. When your script fails or needs to communicate status at exit, use standard exit status codes.
Exit zero for default success status
exit 0
Exit any other number for a failure or warning status. You choose the exit codes for your tool, but be sure to document them if they require more explanation than simple success or failure.
exit 27 - Output to stderr using:
$stderr.puts "error: problem ...."
Bootable Software RAID 0+1, 1+0 in Mac OS X
Posted: February 17, 2008 Filed under: Uncategorized | Tags: diskutil, DiskUtility, mirror, mirrored stripe, nested RAID, software raid, stripe, striped mirror 1 Comment »Software RAID striped mirrors or mirrored stripes are possible in Mac OS X. They may be 10.5 only. I haven’t tested other versions.
Simply create your striped sets using DiskUtility or diskutil, then use the command line diskutil and supply the /dev/diskx entries of the stripe sets when creating your mirror.
First run diskutil list to get the /dev/disk entries for each stripe, then create your mirror using:
diskutil createRAID mirror MirrorName JHFS+ disk1 disk2
where disk1 is the device for the first stripe set and disk2 is the device for the second stripe set.
The result is also bootable and will display correctly as a nested RAID in DiskUtility.app.