krypted March 31st, 2011
launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plistTo enable it:
launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plistIn addition to basic starting and stopping of the mDNSResponder, when troubleshooting any service, one should always look at logs. Log events are logged to the standard syslog facility and so are available via Console. These are locate at /var/log/system.log. Searching for mDNSResponder errors in system.log can also be done from the command line using:
cat /var/log/system.log | grep mDNSResponderOr interactively so you can watch errors as they appear:
tail -f /var/log/system.log | grep mDNSResponderTo see more information in system.log, send a SIGUSR1 to mDNSResponder using killall:
sudo killall -USR1 mDNSResponderTo then see packet-level information in system.log, send a SIGUSR2 to mDNSResponder:
sudo killall -USR2 mDNSResponderTo dump the state into system.log:
sudo killall -INFO mDNSRespondermDNSResponder uses Mach port 5123. Each service that is Bonjour-enabled will register itself with mDNSResponder at that port and can be queried. These are similar to DNS records where they have a prefix for the service and a suffix of the TCP/IP type. For example, IPP Printing is _ipp._tcp, Remote Apple Events is _eppc._tcp., Remote Frame Buffer is _rfb._tcp., SSH is _ssh._tcp., SFTP is _sftp-ssh._tcp., Apple’s Home Sharing is called _home-sharing._tcp, iTunes Music Sharing is _afpovertcp._tcp. and AFP is _afpovertcp._tcp. As an example of UDP traffic, ARD is known as _net-assistant._udp. To see which services are registered (and register services if you build a network service that needs one), use the mDNS command. The -B option for mDNS can be used to query a given namespace. For example, the _afpovertcp._tcp namespace can be queried using the following command:
mDNS -B _afpovertcp._tcpThis would result in the following output, showing all live instances that the system sees:
Timestamp A/R Flags Domain Service Type Instance Name
18:29:40.771 Add 0 local. _afpovertcp._tcp. Krypted MacBook AirTo register services with Bonjour, use the -R operator and to lookup information about a given service instance, use the -L operator. The -L operator allows you to get a lot of information about a given object. Once you have found the object using the -B option you’ll have the Domain and Instance Name. These can be supplied to mDNS to get IPv4, IPv6, port number, and TXT records, which provide a bevy of options, such as information about printers and other services or objects. For example, Mac OS X automatically generates information about printers based on built-in OS information about those printers, such as staple support (Staple=F), collate support (Collate=T) and CUPS admin url’s (adminurl:http://<computer name>:631/printers/<printername>. Other services such as Home Sharing might make heavy use of Machine Name’s or iTunes Database IDs. To use mDNS to obtain this extended output, use the mDNS command, along with the -L option, followed by the Instance Name (the instance name is defined by the service registering the instance and can be a printer name, a computer name, a GUID or whatever the vendor chooses to use. After the Instance Name, provide the address space (Service Type) and then the domain from the -B output. For example, to look at an HP 8565 shared from Krypted MacBook Air called “HP 8565 Krypted MacBook Air”, I would use:
mDNS -L "HP 8565 Krypted MacBook Air" _ipp._tcp local.Other operators not in the man page, but available, include -E for finding recommended registration domains, -F for finding information about browsing domains, -A to test updates to records, -U to test updates to TXT records, -N to test updates to NULL records, -T to test adding big records, -M for multiple records and -I for immediately updating records rather than running through cache. Also available for querying is dns-sd, using identical syntax as mDNS and with the same output. Data regarding systems doesn’t always change dynamically. To reload information following changes, use the -flushcache option of dscacheutil:
dscacheutil -flushcacheWhen I have a chance I’ll try and look at multiple domain name spaces and registering text records as a part 2 of this article, but for now there’s a 2 year old who just woke up and is wanting a little attention (and deservedly so).
krypted March 27th, 2011
defaults read /System/Library/LaunchDaemons/com.apple.periodic-dailyWe could use defaults to go ahead and disable the script by adding a “Disabled=1” key. Or we could unload them using launchctl. You can also do all of this without touching a terminal command. To manage launchd items graphically, look to Peter Borg’s Lingon, available on the App Store or at SourceForge at http://sourceforge.net/projects/lingon. When you open it, simply use the System Daemons in the sidebar and scroll down until you see the com.apple.periodic jobs. Then, uncheck the Enabled checkbox. When you’re ready to turn ’em back on, re-check the Enabled box. If you don’t re-enable these things though, your computer will get very dirty over time. Similar to how if you never clean your house it will eventually turn on you. So imagine your beautiful pristine Xserve or MacBook Air looking like this: You have been warned.
krypted March 17th, 2011
svn --versionTo get started, Subversion uses a repository to store projects. Each client needs a repository and these should be on direct attached drives. The repository hosts a Berkeley database a folder per project you check out, or import. To create a repository in a folder called Repository that lives in your home folder, you can use the following command, which uses the svnadmin command (svnadmin is used for most admin tasks in Subversion and the svn command itself is used for most user operations) and then the create verb, followed by a path:
svnadmin create ~/Repository
Note: These commands are mostly the same in Windows, except you use a drive letter rather than a fully qualified path. They are identical in Linux.Within the Repository directory, each project will have a folder. Within these, you would then create folders for branches, tags and trunk, where trunk is the directories and files you will be working with. Then, we’ll import our first project. To do so we’re going to use the svn command, along with the import verb and then in the second position, we’ll use project to define the type of import. Next, we’ll define the location. The location could be http:// or file:///. In this case we’ll use an existing, mounted AFP file system at /Volumes/myserver/sharedrepo/projectname. Next, we’ll just put a message in there using the -m option, indicating “Initial Import”:
svn import project file:///Volumes/myserver/sharedrepo/projectname -m "First Import"That wasn’t so bad. To see a list of the projects stored in a repository, use the svn command along with the list verb. When I do this, I like to use the –verbose option (optional, thus an option). YOu would also provide the path to the repository:
svn list --verbose file:///Users/cedge/RepositoryTo update the repository:
svn updateWe now have a local copy of the project we imported earlier (creatively called projectname) and can work on it. Before we start working on it though, we want to check it out. To do so, we’ll use the svn command, along with the checkout verb. We’ll then provide the path to the project and name of the project:
svn checkout file:///Users/cedge/Repository/projectname/trunk projectnameWhen you’re done working on things, let’s look at what’s changed using svn’s status verb (btw, a writing point, by making svn possessive there, did I give it a personality? If so, then it’s certainly cranky at times so I suppose that’s fine):
svn statusYou’ll invariably want to add things to a project, which uses the oddly named add verb (bad grammar pun, sry):
svn add filenameRemoving files is a similar process:
svn delete filenameAdding, deleting and changes all need to be committed once you’re done working on the project. To commit changes, use the commit verb. Here, we’re going to provide a message explaining what we did (Added a method for handling invalid file names and bad grammar puns) and then the path:
svn commit -m "Added a method for handling invalid file names and bad grammar puns" file:///Users/cedge/Repository/projectname/trunkI didn’t include tagging, getting releases (list verb), using preshared keys (ssh-keygen, ssh-copy-id, ssh-agent, ssh-add), resolving conflicts (resolved verb), so feel free to add comments with your examples if others read this and would like to add more!
krypted March 12th, 2011
defaults write /System/Library/CoreServices/HelpViewer.app/Contents/Info NSAppleScriptEnabled -bool no
krypted March 11th, 2011
krypted March 10th, 2011
For those of you who need to get out and do something interesting this upcoming October, check out the European Macintosh System Administrators Meeting 2011 (aka MacSysAdmin 2011). It will be October 5-7th and it’s sure to be a blast as in years past. This year, myself and Zack Smith from 318 will both be speaking, as well as Arek Dreyer, Ed Marczak, Nigel Kersten, Duncan McCracken, Greg Neagle, Rick Wylie, Andrina Kelly, Alan Gordon and most notably, Andy Ihnatko!
It’s a pretty awesome lineup and my favorite part about MacSysAdmin is always the fact that the attendees are amongst the highest caliber of system admins I have the chance to work with every year. So mark your calendars for April, when registration is slated to open up!
For more details, see: http://macsysadmin.se/2011/Home.html
krypted March 3rd, 2011
EZIPUTIL PRINT /IMPORT:WINDOWSOnce the command has been completed, you can then list printer queues using the /LIST switch:
EZIPUTIL PRINT /LISTOnce you have created printer queues you will often end up needing to remove a queue or three. To remove a printer queue, you will use the /REMOVE switch along with a /NAME switch to specify the printer queue that you are removing. For example, to remove a queue called Accounting_499 you would use the following command:
EZIPUTIL PRINT /REMOVE /NAME:Accounting_499The VOLUME option has a similar feature in the /REPLICATE_SMB switch, which allows you to replicate existing SMB/CIFS shares:
EZIPUTIL VOLUME /REPLICATE_SMBThe /REMOVE switch can also be used with the VOLUME option. If you have created volumes you can also remove those from the command line. For example, to remove a shared volume called Accounting_Files, you would use the following command:
EZIPUTIL VOLUME /REMOVE /NAME:Accounting_Files
krypted March 1st, 2011