LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-03-2012, 01:14 PM   #1
edwardcode
Member
 
Registered: Apr 2010
Posts: 161

Rep: Reputation: 17
puppet needs to stop a service, do something, then start the service


I need to write puppet code that will stop a service, make a change to a file then start the service. I can not change the file wile it is running. That is why I need to stop the service first. I had this test code:
Code:
service { cupsd : ensure => stopped } -> file { "/home/testing": ensure => true } -> service { cupsd : ensure => running }
But when I run it throws an error saying:

Code:
Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Service[cupsd] is already declared in file /etc/puppet/modules/test/manifests/init.pp at line 2; cannot redeclare on node
I am not sure how to work around this error or how to "declare" something twice.

Any help would be great.

Thanks
 
Old 12-03-2012, 01:58 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982
Puppet defines a state of a system, not how it is done, so if you need to run a series of operations, you'd write a script to do it, and deploy that via puppet with an exec http://docs.puppetlabs.com/reference...type.html#exec

You can't declare it twice as there is no order to the definitions, they aren't executed in order at all, so having two entries is just a direct contradiction of the other.

Last edited by acid_kewpie; 12-03-2012 at 02:00 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to start and stop squid service ? gardenair Linux - Networking 5 08-24-2014 05:13 AM
[SOLVED] Start/stop SSH service? dilzniksan Debian 3 06-12-2010 08:47 PM
Can't start/stop Mysql Service dereko Linux - Server 1 06-28-2009 03:20 PM
service start/stop command stalls..... CaptainInsane Fedora 2 01-20-2007 04:03 PM
start/stop service on the fly zchoyt Linux - Software 3 04-14-2005 03:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration