Eddie
Eddie

Reputation: 580

Calling Puppet from bash script

I'm trying to call puppet from a bash script and whilst it works, it causes my script to end prematurely.

#!/bin/bash

...

function runPuppetLocally()
{
    echo "...running Puppet locally"
    exec puppet agent --test
    echo "Puppet complete"
}
runPuppetLocally

I presume Puppet is issuing an exit or something similar which causes my script to end. Is there a means by which I can call it without it terminating my script?

Upvotes: 0

Views: 742

Answers (1)

choroba
choroba

Reputation: 242423

Why do you use exec? Read help exec:

Replace the shell with the given command.

Your script is replaced with the puppet. If you do not want it to replace your shell, call it normally, i.e.

puppet agent --test

Upvotes: 5

Related Questions