Hello, I''m using puppet 0.25.1 - and I''m trying to create a custom resource to use launchctl to stop a launchd job. command => "launchctl stop `launchctl list | grep $job_real | cut -f 3`", yeilds: err: //sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns: change from notrun to 0 failed: launchctl stop `launchctl list | grep com.Symantec.SymSecondaryLaunch | cut -f 3` returned 1 instead of one of [0] at /var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49 and command => "launchctl list | awk /$job_real/''{system(\"launchctl stop \" \"\\\"\"\$3\"\\\"\");}''`", yeilds: err: //sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns: change from notrun to 0 failed: launchctl list | awk /com.Symantec.SymSecondaryLaunch/''{system("launchctl stop " "\""$3"\"");}''` returned 2 instead of one of [0] at /var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49 Both commands work when done at the command-line (as seen in the error...) and return 0 (when run at the command line). Is the problem that with either command I''m either doing a `` or system() call? Can anyone see a way to make this work? If you''d like me to send the whole resource, I''d be happy to. Thanks, -Roy -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Roy, I don''t believe you need to customize an exec for this - you can simply define a service with the JobID of your Launchd plist, and then send the plist to the /Library/LaunchDaemons directory. See the docs site for the launchd type reference --> http://docs.reductivelabs.com/references/stable/type.html#service and then check out a classfile to ensure our Puppet LaunchDaemon is running --> http://github.com/huronschools/Huron-City-Schools-Puppet-Repository/blob/master/manifests/classes/puppetlaunchdaemon.pp Is this what you''re talking about, or are you thinking of something else? Gary On Mar 3, 2010, at 7:06 PM, Roy Nielsen wrote:> Hello, > > I''m using puppet 0.25.1 - and I''m trying to create a custom resource to use launchctl to stop a launchd job. > > command => "launchctl stop `launchctl list | grep $job_real | cut -f 3`", > > yeilds: > > err: > //sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns: > change from notrun to 0 failed: launchctl stop `launchctl list | grep > com.Symantec.SymSecondaryLaunch | cut -f 3` returned 1 instead of one of > [0] at > /var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49 > > and > > command => "launchctl list | awk /$job_real/''{system(\"launchctl stop \" > \"\\\"\"\$3\"\\\"\");}''`", > > yeilds: > > err: > //sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns: > change from notrun to 0 failed: launchctl list | awk > /com.Symantec.SymSecondaryLaunch/''{system("launchctl stop " > "\""$3"\"");}''` returned 2 instead of one of [0] at > /var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49 > > Both commands work when done at the command-line (as seen in the error...) > and return 0 (when run at the command line). > > Is the problem that with either command I''m either doing a `` or system() > call? > > Can anyone see a way to make this work? > > If you''d like me to send the whole resource, I''d be happy to. > > Thanks, > -Roy > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks Gary, I tried that - but the ensure => stopped doesn''t work for the launchd provider of the service type. see: refacor #2056 under Statler on: http://projects.reductivelabs.com/projects/puppet/roadmap I need some way to stop a launchd process until the refactor happens :) Regards, -Roy On 3/3/10 5:20 PM, Gary Larizza Jr. wrote:> Roy, > I don''t believe you need to customize an exec for this - you can > simply define a service with the JobID of your Launchd plist, and then > send the plist to the /Library/LaunchDaemons directory. See the docs > site for the launchd type reference --> > http://docs.reductivelabs.com/references/stable/type.html#service > and then check out a classfile to ensure our Puppet LaunchDaemon is > running --> > http://github.com/huronschools/Huron-City-Schools-Puppet-Repository/blob/master/manifests/classes/puppetlaunchdaemon.pp Is > this what you''re talking about, or are you thinking of something else? > > Gary > > > On Mar 3, 2010, at 7:06 PM, Roy Nielsen wrote: > >> Hello, >> >> I''m using puppet 0.25.1 - and I''m trying to create a custom resource >> to use launchctl to stop a launchd job. >> >> command => "launchctl stop `launchctl list | grep $job_real | cut -f 3`", >> >> yeilds: >> >> err: >> //sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns: >> change from notrun to 0 failed: launchctl stop `launchctl list | grep >> com.Symantec.SymSecondaryLaunch | cut -f 3` returned 1 instead of one of >> [0] at >> /var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49 >> >> and >> >> command => "launchctl list | awk /$job_real/''{system(\"launchctl stop \" >> \"\\\ <smb:///>"\"\$3\"\\\ <smb:///>"\");}''`", >> >> yeilds: >> >> err: >> //sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns: >> change from notrun to 0 failed: launchctl list | awk >> /com.Symantec.SymSecondaryLaunch/''{system("launchctl stop " >> "\""$3"\"");}''` returned 2 instead of one of [0] at >> /var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49 >> >> Both commands work when done at the command-line (as seen in the error...) >> and return 0 (when run at the command line). >> >> Is the problem that with either command I''m either doing a `` or system() >> call? >> >> Can anyone see a way to make this work? >> >> If you''d like me to send the whole resource, I''d be happy to. >> >> Thanks, >> -Roy >> >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com >> <mailto:puppet-users@googlegroups.com>. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com >> <mailto:puppet-users+unsubscribe@googlegroups.com>. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.