How to write a shell script and How to execute that scripts in OpenPBS?

We have written a script for licenses checking in shell script. But we don’t know to use that script in OpenPBS configuration file. how assign variable and value from the scripts to config file.

Please check this :slight_smile: How to manage Flexnet Licensing in PBS Pro? - #2 by adarsh

  • you can write a query script that retunrs only remaining amount of licenses from the respecitve application license server.

Hi adarsh,
Thanks for your quick reply.

We have done that steps.

We want write custom dyn_resource script. for example,
******** in schedule config file **********
all_lic !/usr/local/bin/check_license.sh
free_lic !/usr/local/bin/free_lic.sh

server_dyn_res:“all_lic free_lic”


that both variables should assign to one dyn_resource.
is it possible ?

that scripts output:
[root@sjrvlsiserver2 pbs]# ./license_check.sh
XT_XPLORER_SE
XT_XCC_TIE
XT_ISS_BASE
XTENSA_SDK
[root@sjrvlsiserver2 pbs]# ./free_lic.sh
2
2
2
2
[root@sjrvlsiserver2 pbs]#

Hi Ramesh,

each of the variable should be one server_dyn_res resource.

Hence you need to you have one per
XT_XPLORER_SE
XT_XCC_TIE
XT_ISS_BASE
XTENSA_SDK

XT_XPLORER_SE !/usr/local/bin/check_license_XT_XPLORER_SE.sh
XT_XCC_TIE !/usr/local/bin/check_license_XT_XCC_TIE.sh
XT_ISS_BASE /usr/local/bin/check_license_XT_ISS_BASE.sh
XTENSA_SDK /usr/local/bin/check_license_XTENSA_SDK .sh

or you can have a script and pass these varialbe as arguments to that script
server_dyn_res: “feature1 !/path/to/script [args]”

for example:
[root@sjrvlsiserver2 pbs]# ./free_lic.sh
2

and not

[root@sjrvlsiserver2 pbs]# ./free_lic.sh
2
2
2
2

Please note , any server dyn resource output should be just an integer and not a string and should have multiple new line characters

Please check this guide and below section

5.14.6.3.ii Example of Floating, Externally-managed License with Features

Hope this helps.

Hi Adarsh
How are you ?

can you please guide me how to set the [args] in schdule configure file ?

FYI: you can have a script and pass these varialbe as arguments to that script
server_dyn_res: “feature1 !/path/to/script [args]”

For example: this is the license check script /usr/local/bin/license.sh

#!/bin/bash
feature=$1
case $feature in
    mech)#here you have your query statement that prints out the available (int) licenses
		#for this feature 
        echo "1"
        ;;
    cfd)#here you have your query statement that prints out the available (int) licenses
		#for this feature 
        echo "2."
        ;;
    opti)#here you have your query statement that prints out the available (int) licenses
		#for this feature 
        echo "2"
        ;;
esac

Add the below line to the $PBS_HOME/sched_priv/sched_config

server_dyn_res: “mech !/usr/local/bin/license.sh mech”
server_dyn_res: “cfd !/usr/local/bin/license.sh cfd”
server_dyn_res: “opti !/usr/local/bin/license.sh opti”

kill -HUP after making these changes to the sched_config

Hope this helps, also you can refer the below section from this guide https://help.altair.com/2024.1.0/PBS%20Professional/PBS2024.1.pdf
5.14.3.1.iii Example of Configuring Dynamic Server-level Resource

Thank you