Difference between revisions of "TigerPage"

From Wikifications
Jump to: navigation, search
(Metadata / Spotlight)
(dsidentity)
Line 82: Line 82:
  
 
You're done!
 
You're done!
 
=== dsidentity ===
 
For all your cli user record manipulation needs
 

Revision as of 19:51, 31 December 2005

This will be populated slowly with my own observations / tips, etc about Tiger.

Metadata / Spotlight

The "Smart Folder" UI does not let you create compound queries with nested logic or "OR". Everything is at the same 'level' of evaluation (in the 'order of operations' sense), and everything is ANDed.

However, the underlying APIs fully support such queries, e.g.:

mdfind -onlyin /Users/andre/foodle "kMDItemFSOwnerUserID == 501 || kMDItemFSOwnerGroupID == 18010"

It is also possible to edit the .savedSearch file that Finder creates when saving a Smart Folder.

Here is an example of an updated "string" attribute from a .savedSearch file that uses an OR:

<string>((kMDItemFSContentChangeDate >= $time.today) &#124;&#124; (kMDItemFSCreationDate >= $time.today)) &amp;&amp; (kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != public.vcard)</string>

(note also the use of &#38; to get a literal ampersand in html, heh)

networking

ipfw / dummynet

  • bandwidth limiting based on UID of socket owner
  • dynamically viewing / adjusting xfer rates in realtime

Basic Rate Limiting

Scenario: I want to limit outgoing bandwidth from a specific service port so it does not saturate my link and lag my ssh sessions. Add the following ipfw rules on the machine hosting the service.

ipfw add pipe 10 ip from any pdps to any
ipfw pipe 10 config bw 40Kbyte/s queue 50KBytes

Where: "pdps" is the service port I'm using (defined in /etc/services); 40Kbyte/s is the rate limit, and 50Kbytes is the size of the queue

Observe your queues as follows:

root@idio[~]ipfw queue show
00010: 320.000 Kbit/s    0 ms  50 KB 1 queues (1 buckets) droptail
    mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 tcp      72.1.149.40/1314    17.216.21.158/50768 11547 16745978 15 22500   5

I'm just getting start on this stuff, the possibilities are endless :)

sys administration

launchd

The One True Solution to process management.

Adding additional listeners

Let's say we also want sshd to listen on port 1314.

Duplicate the ssh config file

root@idio[Library/LaunchDaemons]pwd
/System/Library/LaunchDaemons
root@idio[Library/LaunchDaemons]cp ssh.plist ssh2.plist
root@idio[Library/LaunchDaemons]

Edit the new config file as follows

First we change the Label, which is the name we use to refer to the service (all Lables must be unique)

<key>Label</key>
       <string>com.openssh.sshd</string>

becomes

<key>Label</key>
       <string>com.openssh-alt.sshd</string>

Then we edit the SockServiceName, which determines which listener port is used

<key>SockServiceName</key>
                       <string>ssh</string>

becomes

<key>SockServiceName</key>
                       <string>pdps</string>

Load the new config file

root@idio[Library/LaunchDaemons]launchctl load ./ssh2.plist

Verify that the new port is open

root@idio[Library/LaunchDaemons]netstat -na | grep 1314     
tcp4       0      0  *.1314                 *.*                    LISTEN
tcp6       0      0  *.1314                 *.*                    LISTEN

You're done!