h1. How can I add environment variables to JobScheduler?
The commandline option -env=var_name=var_value
adds an environment variable to the Job Scheduler.
This variable is only in the scope of the Job Scheduler 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 Job Scheduler 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 Job Scheduler 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
If you always want to start the Job Scheduler with additional environment variables then you can edit the SCHEDULER_PARAMS variable in the install_path/bin/jobscheduler_environment_variables.(sh|cmd)
file. Then it is not necessary to call the above startscript with the -env
option.
Sample snippet of install_path/bin/jobscheduler_environment_variables.(sh|cmd)
for adding the variable helloworld:
... # unix sample SCHEDULER_PARAMS="... \"-env=hello=world\" ..." ... rem windows sample set SCHEDULER_PARAMS=... -env="hello=world" ... ...
Windows Service
A Windows service always starts Job Scheduler with the options which are installed. After the Windows Job Scheduler setup a service is already installed so that it must be reinstalled with additional environment variables.
For this close the services dialog (services.msc) if necessary and ...
- stop the Job Scheduler if necessary
windows-shell>[install_path]\bin\jobscheduler.cmd stop
- remove the Job Scheduler service
windows-shell>[install_path]\bin\jobscheduler.cmd remove
- install the Job Scheduler service with
-env
option or edit thejobscheduler_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 Job Scheduler service
windows-shell>[install_path]\bin\jobscheduler.cmd start_service