Command Line Tools

From Lianjapedia
Revision as of 10:13, 17 February 2021 by Yvonne.milne (Talk | contribs)

Jump to: navigation, search

Under Construction

See Also

Background Tasks, Command Line Switches, COMPILE, Lianja Package Manager, Lianja Server Manager on Linux, Lianja Server Manager on Mac, License Management on Linux, License Management on Mac, Script Editor

lianja <.lpk>

Install a Lianja package file and open it in the Lianja App Builder.

lianja <.lpk filename>

Passing the name of a package file to the lianja command allows the package to be installed and opened in the Lianja App Builder.

It assumes that an App with the same name as the package is included in the package.

If it has already been installed and the version is the same then the App will be opened without being updated.

  • Windows
c:\lianja\bin>start /wait lianja c:\lianja\packages\doc_alias-1.0.lpk
  • Linux
lianja doc_alias-1.0.lpk
  • macOS
lianja doc_alias-1.0.lpk

The files from the package are listed in the terminal/command window as they are installed (Windows only).

If the package version of the App is already installed, a 'Package is already installed' message is displayed in the window.

The App is then opened in the Lianja App Builder.

lianja-lm

The lianja-lm License Management utility can be used to activate, deactivate and validate Lianja licenses on Linux and macOS.

Lianja App Builder Licenses

lianja-lm --activate [LianjaAppBuilder] <productkey>
    | --deactivate [LianjaAppBuilder]
    | --validate [LianjaAppBuilder] 

This command should be run as root / using sudo.

Option Description
--activate [LianjaAppBuilder] <productkey> Activate the specified license <productkey>
--deactivate [LianjaAppBuilder] Deactivate the current license
--validate [LianjaAppBuilder] Validate the current license. This checks if the current license is valid.

Lianja Server Licenses

For Lianja Cloud Server and Lianja SQL Server.

lianja-lm  --activate LianjaServer <productkey>
    | --deactivate LianjaServer
    | --validate LianjaServer

This command should be run as root / using sudo.

Option Description
--activate LianjaServer <productkey> Activate the specified license <productkey>
--deactivate LianjaServer Deactivate the current license
--validate LianjaServer Validate the current license. This checks if the current license is valid.

lianja-lpk

Install a Lianja package file or list its contents.

lianja-lpk list | install <.lpk filename> [<lOverwrite>]

The lianja-lpk command can be used to list the contents of the specified package file or to install it.

By default the package file will be installed whether the App is already installed or not. If <lOverwrite> is false or .F., then an existing App will not be overwritten.

  • Windows
c:\lianja\bin>lianja-lpk list c:\lianja\packages\doc_alias-1.0.lpk
c:\lianja\bin>lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk
c:\lianja\bin>lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk false
  • Linux
lianja-lpk list doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk false
  • macOS
lianja-lpk list doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk false

lianja-comp

Compile one or more Lianja/VFP prg files. A fully licensed Lianja App Builder must be installed.

lianja-comp <filename.prg> | <skeleton> | <@textfile>
  • Linux
$ cd /opt/lianja/cloudserver/tenants/public/library
$ lianja-comp chartlib.prg
$ lianja-comp *.prg
$ ls *.prg > prgs.txt
$ lianja-comp @prgs.txt
  • Windows
> cd c:\lianja\cloudserver\tenants\public\library
> lianja-comp chartlib.prg
> lianja-comp *.prg
> dir /B *.prg > prgs.txt
> lianja-comp @prgs.txt
  • macOS
$ cd /Users/Shared/Lianja/cloudserver/tenants/public/library
$ lianja-comp chartlib.prg
$ lianja-comp *.prg
$ ls *.prg > prgs.txt
$ lianja-comp @prgs.txt

lianjarun

Run a background script or command. Available with the Lianja App Builder and Lianja Cloud Server installations.

lianjarun [--runtime] --input | -i <script> --output | -o <output file>
lianjarun [--runtime] --command | -c <command> [--output | -o <output file>]

--input and --output

You specify the input file using the -i (--input) command line switch and the output file using the -o (--output) command line switch.

You can, for example, generate an HTML report and email that to someone using the Amazon AWS Simple Email Service if you have an AWS account.

Examples:

Run a Lianja/VFP script in the current directory.

lianjarun -i myscript.dbo -o myreport.html

Run a python script in the lianjademo app.

lianjarun -i app:/lianjademo/lianjademo_pythondb.py -o myreport.html

Run a PHP script in the lianjademo app.

lianjarun -i app:/lianjademo/lianjademo_phpdb.php -o myreport.html

Run a JavaScript script in the lianjademo app.

lianjarun -i app:/lianjademo/lianjademo_javascriptdb.js -o myreport.html

Notice that these examples will access the development directories as they run lianjarun. If you want to access the runtime directories use the lianjarun command with the --runtime command line switch as shown below.

You can find a full list of command line switches here.

You can perform database admin tasks from the console or in background scripts.

--command

The -c (--command) command line switch allows multiple commands to be concatenated into a script. Each line should be separated with a semi colon and no block statements are supported e.g if, for, do while etc.

lianjarun -c "open database southwind;select top 5 customerid,contactname,companyname \
from customers"
 CUSTOMERID CONTACTNAME                    COMPANYNAME                             
 ALFKI      Maria Anders                   Alfreds Futterkiste
 ANATR      Ana Trujillo                   Ana Trujillo Emparedado
 AROUT      Thomas Hardy                   Around the Horn again
 BERGS      Christina Berglund             Berglunds snabbkop
 BLAUS      Hannah Moos                    Bill's furniture store
5 records selected in <1ms
lianja -c "backup database southwind;"
lianja -c "optimize database southwind;"

If required you can redirect output using the -o switch.

lianjarun -c "open database southwind;select top 5 customerid,contactname,companyname \
from customers" -o mydata.txt

--runtime

If --runtime is specified, the commands operate against the runtime/deployed data and files, otherwise they operate within the context of the App Builder.

lianjarun --runtime -c "select top 5 customerid,contactname,companyname \
from southwind!customers"
lianjarun --runtime -i lib:/myscript.dbo -o myoutput.txt