P
P
Puma Thailand2012-01-15 13:55:17
NoSQL
Puma Thailand, 2012-01-15 13:55:17

Not running bash script in puppet via exec?

Simple four line script /etc/rc.d/rc.mongo:
/usr/bin/mongod --fork --shardsvr --logpath /var/log/mongodb.log --logappend --dbpath /mnt/cloudkc/ mongo > /dev/null 2>&1
/usr/bin/mongod --fork --configsvr --logpath /var/log/mongocfg.log --logappend --dbpath /mnt/cloudkc/mongocfg > /dev/null 2 >&1
sleep 3
/usr/bin/mongos --fork --logpath /var/log/mongos.log --logappend --configdb :27019 > /dev/null 2>&1
Client pappet log error:
Jan 15 18 :52:46 puppet puppet-agent[16099]: (/Stage[main]//Exec[runmongo]/returns) change from notrun to 0 failed: /etc/rc.d/rc.mongo returned 1 instead of one of [0] a
t /etc/puppet/manifests/site.pp:50 I execute
in the manifest like this:
exec { "runmongo":
command =>"/etc/rc.d/rc.mongo",
path => "/usr/bin:/usr/sbin:/bin",
require => File["/etc/rc.d/rc.mongo "],
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2012-01-15
@opium

Adding provider -> shell
exec { "runmongo":
command =>"/etc/rc.d/rc.mongo",
path => "/usr/bin:/usr/sbin:/bin",
provider => shell helped ,
require => File["/etc/rc.d/rc.mongo"],
}

A
Alexander Karabanov, 2012-01-15
@karabanov

I think it is necessary something like this: Perhaps the indication of #!/bin/bash at the beginning of the script will also help ...
exec { "runmongo":
command =>"bash /etc/rc.d/rc.mongo",
path => "/usr/bin:/usr/sbin:/bin",
require => File["/etc/rc.d/rc.mongo"], <-- А вот эта запятая здесь не лишняя?
}

M
m0ps, 2012-01-16
@m0ps

That's right, the puppet didn't know how to execute the file. this is not a binary and the script does not specify an interpreter. Actually, according to the rules - at the beginning of the script, you must specify which interpreter to execute the script with. Above karabanov has already given an example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question