Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplex job environmental variables #720

Open
lgwapnitsky opened this issue Feb 11, 2024 · 3 comments
Open

Multiplex job environmental variables #720

lgwapnitsky opened this issue Feb 11, 2024 · 3 comments

Comments

@lgwapnitsky
Copy link

I have a job that needs to run on multiple systems repeatedly, but each system has a specific environmental variable that needs to be set when the job is run. Currently I have four separate jobs, but would like to combine this into one multiplex job. Is there a way I can set this environmental variable per host when running the multiplex job?

@jhuckaby
Copy link
Owner

I'm so sorry, but this feature does not exist. I cannot think of a way to achieve it with Cronicle. I will add this as a feature request.

@lgwapnitsky
Copy link
Author

lgwapnitsky commented Feb 12, 2024 via email

@dheise-rheinenergie-trading-com
Copy link

You can achieve this by using the shell plugin and some if-then clauses:

#!/bin/bash

export VAR=0
if [[ $(hostname -a) == "server01" ]]; then
	export VAR=1
fi

if [[ $(hostname -a) == "server02" ]]; then
	export VAR=2
fi

if [[ $(hostname -a) == "server03" ]]; then
	export VAR=3
fi

echo $VAR

works for me. depending on the executing server, the correct variable is output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants