Service start and stop

45 views
Skip to first unread message

Satish Katuru

unread,
Jul 2, 2014, 9:33:08 AM7/2/14
to puppet...@googlegroups.com

Hi,

Please see my init.pp file.

First I am stopping the Jboss server and then deleting few folders,copying files and then trying to start the service.

When I place file copy statements it is not working. With out file copy statements I am able to stop the service and start the service.

I am not sure why it is happening like that.

Can any one give us suggestions?


I am using below command for the execution:

sudo puppet agent -t --waitforcert=60 (with debug)


Service stop and folder deletion was successfull.But When I Included the file copy statements like below Service is not getting started.
(

file

{

"/home/katusa02/soa/jboss-soa-p-5/jboss-as/server/default/deploy/RulesService-1.0.esb":

ensure => "present",

mode => "0644",

owner => "katusa02",

group => "katusa02",

source => "puppet://$puppetserver/modules/httpd/RulesService-1.0.esb",

 

}

)


Init.pp

class httpd
{


service{
"stopjavaservice.sh":
ensure =>"stopped",
}



file

{

"/home/katusa02/soa/jboss-soa-p-5/jboss-as/server/default/tmp":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}


file

{

"/home/katusa02/soa/jboss-soa-p-5/jboss-as/server/default/work":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}



file

{

"/home/katusa02/soa/jboss-soa-p-5/jboss-as/server/default/log":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}

file

{

"/home/katusa02/soa/jboss-soa-p-5/jboss-as/server/default/data":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}


file

{

"/home/katusa02/JBossRuntime/log":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}

file

{

"/home/katusa02/JBossRuntime/data":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}


file

{

"/home/katusa02/JBossRuntime/server.log":
ensure => "absent",
force => "true",
recurse => "true",
owner => "katusa02",

}


service{
"startjavaservice.sh":
ensure =>"running",
}


}



Am i Missing any thing here? Do I need to wait for some amount of time for each run?

Regards,
Sathish.

jcbollinger

unread,
Jul 3, 2014, 10:43:10 AM7/3/14
to puppet...@googlegroups.com


On Wednesday, July 2, 2014 8:33:08 AM UTC-5, Satish Katuru wrote:

Hi,

Please see my init.pp file.

First I am stopping the Jboss server and then deleting few folders,copying files and then trying to start the service.

When I place file copy statements it is not working. With out file copy statements I am able to stop the service and start the service.

I am not sure why it is happening like that.

Can any one give us suggestions?


I am using below command for the execution:

sudo puppet agent -t --waitforcert=60 (with debug)



Ok.  Do note that you shouldn't need --waitforcert any more after the first successful run, but including it is harmless.

 

Service stop and folder deletion was successfull.But When I Included the file copy statements like below Service is not getting started.


What does the Puppet --debug output say?  Does it show Service[startjavaservice.sh] being applied successfully?

What do the JBoss logs say?  Is startup failing because JBoss doesn't like the contents of the file, for example?

 
Does the command "service startjavaservice.sh start" (or its equivalent for your platform) return before all JBoss-hosted components are fully up and running?  I think I remember that in days of yore, JBoss's own startup script returned after JBoss itself was booted, but without waiting for deployment or startup of anything inside.

Additionally, you have a serious issue with order of application.  Resources are not guaranteed to be applied by the agent in the order that they are added to the catalog by the master.  This is what the chaining arrows and the 'require' and 'before' metaparameters are for.  Use them.

Furthermore, if you have different "services" to start and stop the same JBoss instance, then you are misusing the service management facilities of Puppet and your OS.  Use Execs instead if you really just want to run different for-purpose scripts.  Or use an Exec to stop JBoss, and a bona fide Service to later ensure that it is running.


John

Satish Katuru

unread,
Jul 4, 2014, 8:16:28 AM7/4/14
to puppet...@googlegroups.com

Hi John,

Thanks for your reply.I used metaparmeters to define order of execution and it is working now.

Regards,
Sathish.
Reply all
Reply to author
Forward
0 new messages