We are trying to make environment variable available to a cron job and request some help with this.
Please find below what we have done:
- We created a shell script "script_a.sh" that accepts a value from the root user in an interactive shell. Once accepted, it would export that accepted value under "userValue" environment variable.
- We have another script called "script_b.sh" invoked by cron job. We would like "userValue" environment variable available to "script_b.sh".
However, the "userValue" is not available to "script_b.sh".
At present, as a temporary alternative we are exporting "userValue" environment variable to ~/.bashrc to make it available to "script_b.sh". However, we don't want to store "userValue" environment variable in plain text in ~/.bashrc due to security reasons.
Can you please help any alternative around it?