OpenVZ Forum


Home » Mailing lists » Users » vztcl runscript and keep the same env variables?
Re: vztcl runscript and keep the same env variables? [message #43568 is a reply to message #43567] Sun, 25 September 2011 16:56 Go to previous messageGo to previous message
samiam is currently offline  samiam
Messages: 15
Registered: July 2011
Junior Member

> In a simple bash script named "test.sh", I used to call another shell
> script "part1.sh" keeping the same Env variables like this:
>
> $head -n 1 test.sh
> . ./part1.sh
>
> Now, I would like to do the same with vzctl runscript:
>
> $head -n 1 test.sh
> vzctl runscript 1110 part1.sh

echo '#!/bin/bash' > tmp.sh
env | awk -F= '{print $1 "=\"" $2 "\""}' >> tmp.sh
cat part1.sh >> tmp.sh
vzctl runscript 1110 tmp.sh
rm tmp.sh

Escaping quotes in environmental variables or using mktemp is left as
an exercise to the reader.

- Sam
 
Read Message
Read Message
Read Message
Previous Topic: Run truecrypt in a container?
Next Topic: /var/lock/subsys directory missing on openvz debian squeeze
Goto Forum:
  


Current Time: Sat Aug 02 05:29:59 GMT 2025

Total time taken to generate the page: 0.48392 seconds