serveradmin(8) BSD System Manager's Manual serveradmin(8)
serveradmin -- command-line interface to Mac OS X Server administrative daemon
serveradmin [-d | -x] command [command_args] serveradmin [-h | -v]
serveradmin is a utility for administering services. In general, it gives you access to the same functionality present in the Server Admin application. It must be run by root.
The following options are available: -d --debug Print command to the terminal. -h --help Print usage summary and exit. -v --version Print build version and exit. -x --xml Generate output as XML instead of key-value pairs.
Except when requesting information with serveradmin -h or serveradmin -v, you must specify a command to select a specific function to perform. Each command accepts its own arguments.
Here are brief descriptions of all the serveradmin commands: list Returns a list of all available services. start service Starts the specified service. stop service Stops the specified service. status service Returns whether or not the service is running. fullstatus service Returns service specific status information. This generally cor- responds to the information shown in the status panel of the Server Admin application. settings command_args This command is used to read and write settings information. It can take arguments from the command line or standard input. set can be used instead of settings. command command_args Allows service specific commands to be performed. com can be used instead of command.
Input and output is done using key value pairs. Keys are specified using colon separated strings, with the first element being the service name (eg. afp:idleDisconnectFlag:adminUsers). Values have types. If the value is in quotes, it is always considered to be a string. Otherwise numbers (5, 10, 8.2) and booleans (yes or no) are converted to the appro- priate type. Assignments are always of the form key = value (eg. afp:guestAccess = yes). If only one key needs to be specified (or set), it can be placed on the command line after the command (eg. serveradmin set afp:guestAccess = yes). However, in some case when doing settings or command, multiple key/value pairs need to be specified. In this case, leaving them out of the argument list (eg. serveradmin settings) will cause the program to read either keys or key/value pairs from the standard input until an end of file (EOF) is reached. The keys or key/value pairs must be one per line. For settings, if no values are specified for the keys, the key value will be read and printed. Otherwise if there is a key/value pair of the form key = value, the value will be set and then echoed back to the output. In general, the best approach is to fetch the settings for an individual service (eg. serveradmin settings afp > dumpfile and then using the out- put as a template for changing settings. Any output when fetching set- tings can be fed in to set values. When setting array values, special notation is needed. There are two types of arrays. Some arrays have special id keys that allow you to access individual array elements. These are accessed using the special key _array_id followed by the value of the id tag (eg. web:Mod- ules:_array_id:dav_module). To add a new element to such an array, you need to have a special line with a "create" value. For example, to add a new web site to the web configuration, you would need: web:Sites:_array_id:MySite = create web:Sites:_array_id:MySite:enabled = yes etc. To delete an element of an array, use the "delete" value (eg. web:Sites:_array_id:MySite = delete). For command, you always need to specify the command type (eg. afp:command = getConnectedUsers). Commands are highly specific to the individual services. See the examples sections for some possible commands.
serveradmin settings all > outfile Stores settings from all services into a file. serveradmin settings < outfile Will take any settings file and set the values. serveradmin settings afp:guestAccess = yes Turns on guest access for the afp server. serveradmin start web Starts the web server. serveradmin command afp:command = getConnectedUsers Returns a list of connected afp users. serveradmin command < commandFile Will execute a command specified in commandFile. Some examples of commands are: afp:command = disconnectUsers afp:message = "You are doomed" afp:minutes = 5 afp:sessionIDsArray:_array_id:0 = 4 afp:command = sendMessage afp:message = "You are doomed" afp:sessionIDsArray:_array_id:0 = 4 info:command = getHardwareInfo info:variant = withQuotaUsage mail:command = getConnectedUsers mail:command = getUserAccounts web:command = getSites
servermgrd(8) Mac OS X Server 04 January 2005 Mac OS X Server
Mac OS X 10.7 - Generated Wed Sep 7 18:16:38 CDT 2011