How to write COS code inside a unix script
Here you have an easy way to write and execute COS code from your unix scripts. This way one does not need to write routines or even open Studio or Atelier. It can be an option for simple and small actions for instance things like installation tasks or compiling.
See sample bash script (compile.sh) to compile classes:
#!/bin/bash ##################################################################### # Script to compile classes # $1 = NAMESPACE # $2 = ClassName # # For example: # ./compile.sh "SAMPLES" "Sample.Person" ##################################################################### echo -n "username:" read username echo -n "password:" read pwd csession HSINSTANCE -U "$1" <<EOFF $username $pwd set status = \$SYSTEM.OBJ.Compile("$2") h EOFF
This is the output from the console:
~/>./compile.sh "SAMPLES" "Sample.Person" username:Admin password:*** Node: mycomputer.com, Instance: HSINSTANCE Username: Password: SAMPLES> Compilation started on 10/13/2016 16:27:29 with qualifiers '' Compiling class Sample.Person Compiling table Sample.Person Compiling routine Sample.Person.1 Compilation finished successfully in 0.295s. SAMPLES> ~/>
Hope someone finds it useful !