User's manual. Section 1.

ON(1): notify the user or run commands when files or user status change


USAGE

        usage: on [-1Du] file [cmd...]
            -1: terminate after the first change
            -D: debug
            -u: don't use unix out
    
            file may be 'user', 'idle', 'busy' and 'wakeup'
            to run the command when the user becomes...
        

DESCRIPTION

On watches for file system or user status changes and runs a command when such event happens. If no command is given the changed file name, or the new user status, is printed. When a command is given, the command is executed with any "%" sign replaced with the name for the changed file or the new user status.

If the file is a directory it is considered as changed when either the directory or its contents change. But there is no recursion to sub-directories.

When file is idle or busy the command is run when the user becomes idle or ceases being idle. When file is wakeup the command runs when the terminal resumes from sleep. When file is user the command runs upon any of these events.

EXAMPLES

    Useful to run when editing sources:
        ; on . Inst -v
        

    Or perhaps

        ; on . Test -v
        

    Synchronize replicas when resuming from sleep:

        ; on wakeup zxsync -v
        

SOURCE

  • /zx/sys/src/clive/cmd/on


User's manual. Section 1.