Modify runtime environment within a sleep script

23 views
Skip to first unread message

dilepton

unread,
Jan 26, 2013, 8:05:17 AM1/26/13
to sleep-de...@googlegroups.com
Hi all, 

I plan to use Sleep in a Windows Terminal Server environment. I need to use Slumber
to connect via jdbc to a Sybase database, fetching some values to modify the PATH 
environment variable and set some specific environment variables for starting the main (native)
Windows binary. 

With exec(@("Program", "Params" ...), %ENV) I'm able to pass a modified environment, but
how to modify the System Environment? E.g the PATH variable to add some search pathes 
for the main binary and additional Windows libs, which are not in the System path variable? 

Any idea?

Kind regards - Alfred 

Raphael Mudge

unread,
Jan 26, 2013, 7:46:05 PM1/26/13
to sleep-de...@googlegroups.com
Hi Alfred,
I don't know if Java can do this. What I typically do is either start
my Java program in a .bat file that sets up the environment I need or
I spawn a child program with the modified environment it needs.
> --
> --
> -----
> To post to this group, send email to sleep-de...@googlegroups.com
> To unsubscribe from this group, send email to
> sleep-develope...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sleep-developers?hl=en
>
> The Sleep Scripting Project: http://sleep.dashnine.org/
>
>

dilepton

unread,
Jan 27, 2013, 6:37:14 AM1/27/13
to sleep-de...@googlegroups.com
Hi Raphael, just to clarify:

The chain of calls would be
1. Batch file starts the Java with the Sleep script
2. Sleep script somehow modifies the environement
3. Windows binary called with modified environment

I would love to use Sleep's capabilities to connect to a database with Slumber and JDBC
to fetch the config values from a database.

How would you modify the environment for the child program?

Kind regards - dilepton
Reply all
Reply to author
Forward
0 new messages