pre command

Synopsis

pre command <string>

Description

Specifies a shell command that will be executed before 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 execute any commands needed to make the software flush changes to disk, and close open files. You can then use post command to make such software re-open the files it needs and start operating again.

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, post command