• Mac OS X

    Automatically Emailing Logs

    As I have mentioned in the past, you can send mail from the command line by initiating a telnet session into port 25 of a mail server. Provided you have setup Mail.app you can also email from the command line using the mail command. In the below command we’re going to pipe the contents of a log file into an email by reading the contents using a cat command. From the output of the cat command we’re then going to email the contents of the file to an email address, specifying the subject line of the email using the -s option of the ppp command: cat /var/log/ppp.log | mail -s…

  • Windows Server,  Windows XP,  Xsan

    StorNext Command Line for Windows

    StorNext for Windows comes with many of the same commands that are available with Xsan on Mac OS X. Located by default in the c:Program FilesStorNextbin directory, you can use the cv* commands in much the same way as on a Mac. This can help with regards to troubleshooting. For example, if you are having problems getting a volume to mount, even though it shows up when you go to map the drive in Client Configuration, you can use cvlabel -l (assuming your working directory is the StorNext bin directory) to see the LUNs that are accessible by your host. If you cannot see your LUNs then you also cannot…

  • Consulting,  Network Infrastructure,  sites,  Unix,  VMware

    S3 Command Line Part II

    Earlier we looked at using s3cmd to interact with the Amazon S3 storage cloud.  Now we’re going to delve into using Another S3 Bash Interface.  To get started, first download the scripts and then copy the hmac and s3 commands into the ec2 folder created in previous walkthroughs. To use the s3 script, you need to store your Amazon secret key in a text file and set two environment variables. The INSTALL file included with the package has all the details. The only tricky part I ran into, and from the comments on Amazon, other people ran into, is how to create the secret key text file. Now go into your…

  • Articles and Books,  Business,  Consulting,  Mac OS X,  Mac OS X Server,  Mac Security

    10 Quick SysAdmin Time Savers

    I’m not gonna’ lie to you, I’m a pretty lazy admin. As such, I look for ways to reduce the amount of typing I have to do routinely. And ways to not make mistakes that I made when I was young and needed the rupies. The more time I spend at the command line, the more I use these, so here goes (hope they help you in some way shape or form): Make your own bin and put stuff you use often in there.  You can use any folder you like and just include it in the export PATH=$PATH line by throwing a : at the end and typing that path.…

  • Mac OS X,  Mac Security,  Mass Deployment

    sqlite3 and Address Book.app from the Command Line

    The Mac OS X program, Address Book uses sqlite3 to store information.  The actual database is located in each users Library/Application Support/AddressBook directory and called AddressBook-v22.abcddb.  In order to interfaces with Address Book.app you can use the sqlite3 command followed by the path to the database itself.  For example, the following command will simply dump you into a sqlite interactive command line environment: sqlite3 ~/Library/Application Support/AddressBook/AddressBook-v22.abcddb Once in the environment you can view databases, manually work with the data, etc.  The basic information about a contact is stored in the ZABCDRECORD table.  You can view the contents of this table using the following command: select * from ZABCDRECORD If you…

  • Mac OS X,  Mass Deployment

    Mac: Disable AutoUpdate

    Here’s a quick command line you can send out to disable the Microsoft Office auto-update functionality. This is particularly useful in environments where you are freezing systems and then pushing out all updates, rather than allowing hosts to automatically install updates: defaults write com.microsoft.autoupdate HowToCheck -string “Manual” Note: Autoupdate has now been updated to version 2, so the string for more modern versions of Office is now: defaults write com.microsoft.autoupdate2 HowToCheck -string “Manual” Thanks to @seankaiser for the update!

  • Mac OS X

    Reading Address Book from the Command Line

    There isn’t an easy-to-use command line interface to the Address Book. You can use AppleScript with it, but not necessarily the command line. This isn’t to say there isn’t an AddressBook framework waiting for someone to use it. Well, Scott Stevenson posted a tool on his blog, Theocacao. This tool is pretty rudimentary but can be useful for a few basic tasks, and provides a nice framework for the development of a larger tool. Basically, abtool has one positional parameter – a search string. Using that it will look for a pattern in the name. It doesn’t search any of the other fields, use wildcards, nor allow for changing of…

  • Mac OS X

    Mac OS X: Fast User Switching

    Fast User Switching is a feature in Mac OS X (and Windows for that matter) that allows you to switch user accounts without logging out of your computer.  This allows multiple users to use the same computer without having privy to each others stuff and allows you a great way to leave the system if you have multiple people that use it (you don’t want others unlocking into your account, for example).  Fast User Switching is disabled by default though.  To enable fast user switching, open the System Preferences and click on  the Accounts System Preference pane.  Then, click on Login Options and click the Enable fast user switching checkbox. To enable Fast User…

  • Mac OS X,  Mass Deployment

    Command Line System Information

    When you click on About This Mac and then click on More Info… you see the Apple System Profiler.  This tool, dating back to the Classic OS (prehistory so-to-speak) can be used to access a wide variety of information about your system, including installed hardware, software and some settings.  Some of this information can also be obtained through other tools.  For example, the networksetup command can obtain a wide variety of information about various network settings.  But it helps to have one tool to query for any information you may need about a computer (well, much of the information you may need).   While it is fairly straight forward to…

  • Mac OS X

    Mac OS X: Changing Locations from the CLI

    The scselect command only does one thing.  Open up your System Preferences and click on the Network System Preference pane.  Create a new location called test and then put your system back to the old location (obviously don’t do crap like this on a production server or anything like that).  Now fire up Terminal and type the following command: scselect test Provided your location was called test you should see your Network System Preference pane update immediately with the new information.  Now let’s say that you wanted to defer the new location to become active until you reboot next.  Apple included the one and only option for scselect as the…