4D v13.4

Appendix B: Command Line Interface (CLI) under Mac OS

Home

 
4D v13.4
Appendix B: Command Line Interface (CLI) under Mac OS

Appendix B: Command Line Interface (CLI) under Mac OS  


 

 

You can use a command line in the Mac OS X Terminal to drive your 4D applications (4D and 4D Server). This function allows you to open or close a database remotely, which can be particularly useful for administering Web servers.

To be able to execute most 4D commands using the Mac OS X Terminal, you must first access the folder where the application is found inside the package (Contents/MacOS path).
For example, if the 4D package is located in the MyFolder folder, you must write the command line as follows:

/MyFolder/4D.app/Contents/MacOS/4D

Note: You can also insert the command line using drag and drop with the application icon in the Terminal. 

It is recommended that you pass the “&” character at the end of the command line so that the application is executed as a background task in a separate process. For example:

/MyFolder/4D.app/Contents/MacOS/4D &

Here is a description of command lines and their arguments which are supported by 4D applications:

  • Launch application
    Syntax: Path/ApplicationName
    Example:
    4D.app/Contents/MacOS/4D &

    The action of this command is identical to double-clicking the 4D application. The application is executed and the select database dialog box appears.
  • Launch application with a structure file
    Syntax: Path/ApplicationName StructurePath
    Example:
    4D.app/Contents/MacOS/4D /Users/Roger/Databases/MyDatabase/MyDatabase.4DB

    This command launches the application and opens the designated structure file with the current data file. No dialog box appears.
  • Launch application with a structure file and a data file
    Syntax: Path/ApplicationName -d DataPath StructurePath
    Example:
    4D.app/Contents/MacOS/4D -d /Users/Roger /Databases/MyDatabase/MyDatabase.4DD /Users/Roger/Databases/MyDatabase/MyDatabase.4DB

    This command launches the application and opens the designated structure file with the selected data file. No dialog box appears.
  • Quit application
    Syntax: kill -s INT process_ID
    Example:
    Kill -s INT 323

    The action of this command is identical to selecting the Quit command. The processes are shut down one by one; the cache is saved; and the application quits.
    Note: The process number of the 4D application (process_ID) can be obtained using commands such as ps or top.
  • Help
    Syntax: Path/ApplicationName -h
    Example:
    4D.app/Contents/MacOS/4D -h

    This command displays a summary of commands that can be used with 4D in the Mac OS X Terminal.
  • Launch the application in a user session other than the current session
    Syntax: Path/ApplicationName -u UserName -g GroupName
    Example:
    4D.app/Contents/MacOS/4D -u john -g accnt

    This command forces the application to launch using the specified user session (the current user session is used by default).

 
PROPERTIES 

Product: 4D
Theme: Appendixes