Is it possible to run the script on the host after the container starts?

al.semenenko88

Renowned Member
Dec 25, 2017
26
0
66
37
I'm trying to do this:

test.sh
#!/bin/bash
/mnt/.../test2.sh&

test2.sh
#!/bin/bash
sleep 10
echo "test" > /root/test.txt

104.conf
lxc.hook.pre-start: /mnt/.../test.sh

In this case, the container wait for 15 seconds, creates a file, and then starts.

104.conf
lxc.hook.pre-start: /mnt/.../test2.sh&

In this case, container doesn't start, but the script is executed.

Is it possible to run the script on the host after the container starts?
 
Last edited:
so works:

test.sh

bash -s < /mnt/.../test2.sh > /dev/null 2>&1 &

104.conf

lxc.hook.pre-start: /mnt/.../test.sh