You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

h1. How can I add environment variables to JobScheduler?

The commandline option -env=var_name=var_value adds an environment variable to the JobScheduler.
This variable is only in the scope of the JobScheduler established.
If a variable var_name already exists in the user environment then the value of the -env option wins.
A Windows service of the JobScheduler reads only the system and user environment if it has the corresponding user account.

The environment variables can be used for substitutions (see Job Scheduler Reference Documentation).

Startscript with -env

Sample for starting the JobScheduler with the variable hellh1. world:

 unix-shell>[install_path]/bin/jobscheduler.sh start -env="hello=world" 
 windows-shell>[install_path]\bin\jobscheduler.cmd start -env="hello=world"

Edit jobscheduler_environment_variables.(sh|cmd) file

The JobScheduler startscript reads the environment from the .\user_bin\jobscheduler_environment_variables.(sh|cmd) script.
You find an example .\user_bin\jobscheduler_environment_variables.(sh|cmd)-example. Rename this file to .\user_bin\jobscheduler_environment_variables.(sh|cmd).
On Unix make sure that ./user_bin/jobeditor_environment_variables.sh is executable.
Edit .\user_bin\jobscheduler_environment_variables.(sh|cmd) if you always want to start the JobScheduler with additional environment variables.
Then it is not necessary to call the above startscript with the -env option.

Sample snippet of install_path/user_bin/jobscheduler_environment_variables.(sh|cmd) for adding the variable helloworld:

 ...
 # unix 
 export hello="world"
 ...
 ...
 rem windows 
 SET SCHEDULER_PARAMS=%SCHEDULER_PARAMS% -env="hello=world" 
 SET SCHEDULER_START_PARAMS=%SCHEDULER_START_PARAMS% -env="hello=world"
 ...

Windows Service

A Windows service always starts JobScheduler with the options which are installed. After the Windows JobScheduler setup a service is already installed so that it must be reinstalled with additional environment variables.

For this ...

  • stop the JobScheduler if necessary
 windows-shell>[install_path]\bin\jobscheduler.cmd stop
  • remove the JobScheduler service
 windows-shell>[install_path]\bin\jobscheduler.cmd remove
  • install the JobScheduler service with -env option or edit the jobscheduler_environment_variables.cmd file like above
 windows-shell>[install_path]\bin\jobscheduler.cmd install -env=hello=world
 ...or...
 windows-shell>[install_path]\bin\jobscheduler.cmd install
  • start the JobScheduler service
 windows-shell>[install_path]\bin\jobscheduler.cmd start_service
  • No labels