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 message every time they log in. Perhaps 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 CD-ROMs) before a connection is finalized.

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 root on some systems.

An interesting example may be:

        /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 CD-ROMs) after a connection is closed.


Next Previous Contents