# post command

## Synopsis

    post command <string>

## Description

Specifies a shell command that will be executed after online defragmentation processes a file. The command will be passed the full path to the file in the shell variable `$0` and is run under `/bin/sh`.

Note that the command is run as the user that started iDefrag. If you need elevated privileges for the command you wish to run, you will need to investigate appropriate mechanisms for privilege escalation (e.g. the setuid bit).

This feature is intended for use with systems running database servers and other similar software, where it can be used to automatically re-open files and restart operation after pre command is used to close them and suspend service.

## Example

    // Display messages on the system console before and after
    // defragmenting any file in /stuff

    class "Stuff" {
      match files where file is within "/stuff"
      color "#ccccff"
      pre command "echo \"About to defragment $0\""
      post command "echo \"Just defragmented $0\""
    }

## See also

class, pre command