Linuxconf:SAMBA Homes Interface: Scripts

Next Previous Contents

## 5. Scripts

Some scripts may be executed as share connection/disconnection time.

## 5.1 Setup Command (AKA preexec)

This option specifies a command to be run whenever the service is connected to. It takes the usual substitutions.

An interesting example is to send the users a welcome mes sage every time they log in. Maybe a message of the day? Here is an example:

> `

>             csh -c 'echo \"Welcome to %S!\" | \ /usr/local/samba/bin/smbclient
>                     -M %m -I %I' &

> `

Of course, this could get annoying after a while :-)

See also Cleanup Command.

Default: None (no command executed)

Example: echo \"%u connected to %S from %m (%I)\" >> /tmp/log

## 5.2 Setup Command (root)

This is the same as Setup Command except that the command is run as root. This is useful for mounting filesystems (such as cdroms) before a connection is finalised.

## 5.3 Cleanup Command

This option specifies a command to be run whenever the service is disconnected. It takes the usual substitutions. The command may be run as the root on some systems.

An interesting example may be do unmount server resources:

> `

>             /sbin/umount /mnt/cdrom

> `

See also Setup Command.

Default: None (no command executed)

Example: echo \"%u disconnected from %S from %m (%I)\" >> /tmp/log

## 5.4 Cleanup Command (root)

This is the same as postexec except that the command is run as root. This is useful for unmounting filesystems (such as cdroms) after a connection is closed.

Next Previous Contents