Difference between revisions of "Command Line Tools"
Yvonne.milne (Talk | contribs) (→lianja-lpk) |
Yvonne.milne (Talk | contribs) (→lianja-lpk) |
||
Line 107: | Line 107: | ||
* Windows | * Windows | ||
− | |||
<pre>lianja-lpk list c:\lianja\packages\doc_alias-1.0.lpk | <pre>lianja-lpk list c:\lianja\packages\doc_alias-1.0.lpk |
Revision as of 07:47, 22 March 2021
Contents
Overview
Lianja Command Line Tools are run at the Operation System prompt from a Windows command window or Linux / macOS terminal window.
- Handle Lianja package files: lianja <.lpk filename> and lianja-lpk
- Manage licenses on Linux and macOS: lianja-lm
- Compile Lianja/VFP script files: lianja-comp
- Run background scripts and Lianja/VFP commands: lianjarun
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
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
Handle Lianja package files.
- List the contents of a Lianja package file
lianja-lpk list <.lpk filename>
- Create a Lianja package file
Use special prefixes such as 'app:/' and 'lib:/' for the files. Separate filelist files with ; on Windows and + on Linux/macOS.
lianja-lpk build <.lpk filename> file | filelist
- Add files to an existing Lianja package file
Use special prefixes such as 'app:/' and 'lib:/' for the files. Separate filelist files with ; on Windows and + on Linux/macOS.
lianja-lpk add <.lpk filename> file | filelist
- Refresh a Lianja package file with any updated files
lianja-lpk refresh <.lpk filename>
- Extract and install a Lianja package file
lianja-lpk install <.lpk filename> [<lOverwrite>]
By default the package file will be installed whether the App is already installed or not. If <lOverwrite> is false or .F., then existing App files will not be overwritten.
- Extract and install a Lianja package file
lianja-lpk update <.lpk filename> [<lOverwrite>]
If <lOverwrite> is false or .F., then existing App files will not be overwritten, otherwise they will be overwritten.
- Windows
lianja-lpk list c:\lianja\packages\doc_alias-1.0.lpk lianja-lpk build webapp1-1.0.lpk app:/example_webapp1 lianja-lpk build webapp123-1.0.lpk ^ app:/example_webapp1;app:/example_webapp2;app:/example_webapp3;lib:/helloworld.prg lianja-lpk add webapp1-1.0.lpk ^ app:/example_webapp1;app:/example_webapp2;app:/example_webapp3;lib:/helloworld.prg lianja-lpk refresh c:\lianja\packages\doc_alias-1.0.lpk lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk false lianja-lpk update c:\lianja\packages\doc_alias-1.0.lpk lianja-lpk update c:\lianja\packages\doc_alias-1.0.lpk false
- Linux
lianja-lpk list doc_alias-1.0.lpk lianja-lpk build webapp1-1.0.lpk app:/example_webapp1 lianja-lpk build webapp123-1.0.lpk \ app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg lianja-lpk add webapp1-1.0.lpk \ app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg lianja-lpk refresh doc_alias-1.0.lpk lianja-lpk install doc_alias-1.0.lpk lianja-lpk install doc_alias-1.0.lpk false lianja-lpk update doc_alias-1.0.lpk lianja-lpk update doc_alias-1.0.lpk false
- macOS
lianja-lpk list doc_alias-1.0.lpk lianja-lpk build webapp1-1.0.lpk app:/example_webapp1 lianja-lpk build webapp123-1.0.lpk \ app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg lianja-lpk add webapp1-1.0.lpk \ app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg lianja-lpk refresh doc_alias-1.0.lpk lianja-lpk install doc_alias-1.0.lpk lianja-lpk install doc_alias-1.0.lpk false lianja-lpk update doc_alias-1.0.lpk lianja-lpk update 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>
- Windows
Note: the App Builder should be closed before running lianja-comp
cd c:\lianja\cloudserver\tenants\public\library lianja-comp chartlib.prg lianja-comp *.prg dir /B *.prg > prgs.txt lianja-comp @prgs.txt
- Linux
cd /opt/lianja/cloudserver/tenants/public/library lianja-comp chartlib.prg lianja-comp *.prg ls *.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