Class Set Definition File Syntax


Synopsis

post command <string>

Description

Specifies a shell command that will be executed after on-line 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 to obtain such privileges (e.g. the setuid bit).

Warning: Novice systems administrators are cautioned that there are security risks inherent in the use of the setuid flag. Please make certain that you understand the implications of using setuid before making use of this feature.

A particular use for this feature is on systems running database servers and other server software, where it can be used to automatically handle any commands necessary to make the software flush all changes to disk, close open files and then re-open them after defragmentation.

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