[Semibug] Setting environment variables
Mark Moellering
markmoellering at psyberation.com
Wed Aug 9 16:24:19 EDT 2023
On 8/9/23 15:57, Mike Wayne wrote:
> On Wed, Aug 09, 2023 at 03:34:42PM -0400, Mark Moellering wrote:
>> Everyone,
>>
>>
>> I have come across an issue which should be incredibly common, yet I
>> have not found a single clear cut answer on it.
>>
>> I am running dehydrated on a mail server, in a jail.?? To run, I need to
>> set environment variables.?? While I can easily set the variables via the
>> command line, I want to be able to run the command via a cronjob, and
>> would prefer to have the environment variables set via a script, so I
>> don't have to worry about them being unset, if the server or jail get
>> rebooted.
>
> You can create a script and do everything there. Test your script in a subshell that
> sets path to "/usr/bin:/bin"
>
> or:
>
> * * * * * user source ~/.file_that_sets_env_vars; comand-that-requires-env-vars
>
> _______________________________________________
> Semibug mailing list
> Semibug at lists.nycbug.org
> https://lists.nycbug.org:8443/mailman/listinfo/semibug
I am not sure what you mean by "test your script in a subshell" ... I
am more of a programmer than an admin.
Here is my script:
-----------------------------------------------------
#!/bin/sh
GODADDY_KEY="xxxxxx"
export GODADDY_KEY
GODADDY_SECRET="yyyyyy"
export GODADDY_SECRET
-----------------------------------------------------
The script runs and exits cleanly but if I run "env" afterwards, the
environment variables are not set. I have no idea what I am doing wrong.
More information about the Semibug
mailing list