beautypg.com

Apple Remote Desktop (Administrator’s Guide) User Manual

Page 145

background image

Chapter 8

Administering Client Computers

145

Executing a Single UNIX Command

Using the UNIX Command window, you can send a single command to the selected
client computers. The command is executed using the bash shell.

To execute a single UNIX command:

1

Select a computer list in the Remote Desktop window.

2

Select one or more computers in the selected computer list.

3

Choose Manage > Send UNIX Command.

4

Type or paste the command.
If your command is a multi-line script, enter each command on its own line. If you want
to break up a single-line command for better readability, use a backslash (\) to begin a
new line.

5

Set the permissions used to execute the command.
You can choose the currently logged-in user, or choose the name of another user on
the client computers.

6

Click Send.

Executing Scripts Using Send UNIX Command

There are two kinds of scripts you can execute via the command line. First, and most
common with command lines, is a shell script. A shell script is a file containing a
collection of UNIX commands that are all executed in sequence. Shell scripts can have
normal programming procedures like loops, conditionals, and variables. Shell scripts
are text files with UNIX line endings. Shell scripts are interpreted using the bash shell.

The second kind of script you can execute, and the most common in the Mac OS X
environment, is an AppleScript. AppleScripts are files that contain English-like
commands, using the AppleScript programming language and they are created using
the Script Editor application.

Running a UNIX command as the current user will fail if the target computer is at the
login window, since there is no current user at that point. You can use root user for
tasks by entering root in the specified user field of the task dialog. You don’t actually
need to have the root account enabled on the client computer to specify the root user.
You should never use

sudo

or

su

to do tasks as the root user. They are interactive and

expect further input and response from your script. Instead, run your script as root or
whatever user you were planning on.

Executing Shell Scripts with Remote Desktop
Shell scripts can be copied, then executed. If a script has any degree of complexity, or if
it cannot be expressed on a single line, you can use Copy Items to copy the script file to
the client computers, then execute it using Send UNIX Command. To send a single-line
command you can simply use Send UNIX Command.

This manual is related to the following products: