SysOb ======= Carsten Lutz ( clu@malihh.hanse.de ) some hints for using SysOb: SysOb must be setuid-root or the Process-Inspector and some other functions will not work ! User-Inspector -------------- - double-click a user to enable the pull-down-menu for single-user actions. - All masks ( e.g. the name and port - masks in the options-window ) are regular expressions. So if you want only the users displayed, who's names start with 'u', use '^u.*' as mask instead of 'u*' or such nonsense... - Sending messages to or logging off _multiple_ users with one action is NOT possible yet. - The talk-action is a real cludge, yet, which might not work with OS- versions > 2.1 and it will not even work with OS 2.1 everytime !!! Process-Inspector ----------------- - The CPU-load and number of processes display is only the load and number of the displayed processes, not of all processes running ! So if you want to get the total load and number of processes, disable all masks and deselect "show threads" and "only with TTY" in the optionspanel. - If "show threads" is enabled, threads are displayed instead of tasks. Some fields are equal for all threads of a task then, because they are task- and not thread-specific. These fields are Commandname, PID, PGRP, PPID, Username, UID, controlling TTY, virtual size, real size, commandline and environment. This software is free, enjoy ! feedback is very welcome ! If you wonder about it, here are some infos about the talk-kludge and why it's a real kludge: Q: How can I start up Terminal from my app and have it do something, like IB's make command used to do in 1.0? I want my app to open a Terminal window and automatically cd to some directory, in which the user will type SQL commands. I want them to be able to quit this shell and be returned to my app. A: Currently, there's a hack using msgPaste:, where you paste ASCII into Terminal using Speaker/Listener. The msgPaste: Speaker/Listener interface to Terminal is a shameful *secret:, not that anyone seems to have refrained from using it. It was supposed to have been disabled for 2.0 because it's rather flaky. The bug is that Terminal doesn't get the message 100% of the time. When it does work, Terminal should open a new window for each msgPaste: message that you send it. This behavior of Terminal should not be relied upon and should not go into a shipping product. We're hoping that remote objects will be complete soon enough to allow Terminal to be fitted with a nice RO interface for 3.0. This would allow you to do something like: myTerm = [Terminal newShell]; [myTerm pasteText:"cd /foo/bar/somewhere"]; [myTerm pasteText:"SQL_processor"]; [myTerm setDelegate:self]; and have a -windowDidClose delegate method that would alert you to the end of the session. Anyway, here's how to do it using the msgPaste approach. Launch Terminal and do a msgPaste of the command lines to cd and to invoke the SQL processor. Here's some sample code, lifted and adapted from Henry's FilePad: - sendToTerminal:(char *) command { port_t thePort; thePort = NXPortFromName("Terminal", NULL); if (thePort != PORT_NULL) { int flag; id pasteboard=[Pasteboard newName:NXSelectionPboard]; [pasteboard declareTypes:&NXAsciiPboardType num:1 owner:self]; [pasteboard writeType:NXAsciiPboard data:command length:strlen(command)]; [[NXApp appSpeaker] setSendPort:thePort]; [[NXApp appSpeaker] msgPaste:&flag]; } else printf("Couldn't connect to Terminal\n"); return self; } When the user quits Terminal, the app's window should come to the front. If you really need to have your app be informed when they've quit their Terminal session, you have to do some uglier stuff instead: 1) Arrange for the main app to provide some clue to its identitiy - write its PID to a file, make itself available through Speaker/Listener, or something like that. 2) Write a little C program that forks off a copy of the shell with its arguments, waits for it to exit, and then messages the main app with a signal, S/L message, etc. Put this in the main app's wrapper. 3) When the time comes to do the shell trick, determine the value of the default Terminal:Shell (probably "/bin/csh" or "/bin/sh"), and save it. 4) Write out a new value for this default that is of the form /foo/bar/wrapper.app/little_C_prog cd somewhere/else 5) Do the Terminal msgPaste stuff as above. (You don't need to paste the cd command, since you did that in step 4 this time.) Terminal will be smart enough to pick up the new Shell and will run the stub in a new window. 6) As soon as the command is pasted, immediately reset the Terminal Shell default to its original value. 7) Wait for the stub to signal that the shell running in the window has exited.