Hi everbody !!! I would like to know how to use the parameter start of the service resource type. Because i want to use my own script to start my service. I have tried 2 cases and did''nt work. Here are the cases : service { ''myservice'': start => ''/root/myinit_script.sh'' } service { ''myservice'': start => "/root/myinit_script.sh" } Do you have any idea on how to use this parameter? Thans very much for help. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/W1dRjH4ugwoJ. 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.
On Aug 6, 2012, at 2:45 PM, Rost wrote:> Hi everbody !!! > > I would like to know how to use the parameter start of the service resource type. Because i want to use my own script to start my service. > I have tried 2 cases and did''nt work. > > Here are the cases : > > service { ''myservice'': > start => ''/root/myinit_script.sh'' > } > > service { ''myservice'': > start => "/root/myinit_script.sh" > } > > > Do you have any idea on how to use this parameter? > > Thans very much for help.Rost, Is what you pasted about the entire ''myservice'' resource definition or did you leave our the ''ensure'' lines for brevity? Make sure you have an ''ensure => running," line in the service definition if you want puppet to ensure that state. There might also be a problem with your init script. Can you please post the contents of myinit_script.sh here? -- Peter Bukowinski -- 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.
hi Peter, Thanks for watching . Actually that''s all my service resource without the ensure => running. Should I use that parameter to have puppet launch my script? Here is the content of myinit_script.sh. #!/bin/sh echo "Starting Apache2" /opt/apache2/bin/apachectl -f /opt/apache2/conf/httpd -k start Thanks a lot. Le lundi 6 août 2012 21:39:23 UTC+2, pmbuko a écrit :> > On Aug 6, 2012, at 2:45 PM, Rost wrote: > > Hi everbody !!! > > I would like to know how to use the parameter start of the service > resource type. Because i want to use my own script to start my service. > I have tried 2 cases and did''nt work. > > Here are the cases : > > service { ''myservice'': > start => ''/root/myinit_script.sh'' > } > > service { ''myservice'': > start => "/root/myinit_script.sh" > } > > > Do you have any idea on how to use this parameter? > > Thans very much for help. > > > Rost, > > Is what you pasted about the entire ''myservice'' resource definition or did > you leave our the ''ensure'' lines for brevity? Make sure you have an ''ensure > => running," line in the service definition if you want puppet to ensure > that state. There might also be a problem with your init script. Can you > please post the contents of myinit_script.sh here? > > -- > Peter Bukowinski >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/o_m0fn9FLnAJ. 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.
Yes, you should have the ensure parameter in there: service { ''myservice'': ensure => running, start => ''/root/myinit_script.sh'', } Since you''re using a custom start script, you may need to also specify custom status and restart scripts so that puppet can better control the process if the httpd config file ever changes and you want the service to restart automatically. -- Peter On Aug 6, 2012, at 5:03 PM, Rost wrote:> hi Peter, > > Thanks for watching . > Actually that''s all my service resource without the ensure => running. Should I use that parameter to have puppet launch my script? > Here is the content of myinit_script.sh. > > #!/bin/sh > echo "Starting Apache2" > /opt/apache2/bin/apachectl -f /opt/apache2/conf/httpd -k start > > Thanks a lot. > > > Le lundi 6 août 2012 21:39:23 UTC+2, pmbuko a écrit : > On Aug 6, 2012, at 2:45 PM, Rost wrote: > >> Hi everbody !!! >> >> I would like to know how to use the parameter start of the service resource type. Because i want to use my own script to start my service. >> I have tried 2 cases and did''nt work. >> >> Here are the cases : >> >> service { ''myservice'': >> start => ''/root/myinit_script.sh'' >> } >> >> service { ''myservice'': >> start => "/root/myinit_script.sh" >> } >> >> >> Do you have any idea on how to use this parameter? >> >> Thans very much for help. > > Rost, > > Is what you pasted about the entire ''myservice'' resource definition or did you leave our the ''ensure'' lines for brevity? Make sure you have an ''ensure => running," line in the service definition if you want puppet to ensure that state. There might also be a problem with your init script. Can you please post the contents of myinit_script.sh here? > > -- > Peter Bukowinski > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/o_m0fn9FLnAJ. > 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.-- Peter -- 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.
Thank you very much Peter, It''s working, I just love Puppet. Le lundi 6 août 2012 23:17:37 UTC+2, pmbuko a écrit :> > Yes, you should have the ensure parameter in there: > > service { ''myservice'': > ensure => running, > start => ''/root/myinit_script.sh'', > } > > Since you''re using a custom start script, you may need to also specify > custom status and restart scripts so that puppet can better control the > process if the httpd config file ever changes and you want the service to > restart automatically. > > -- > Peter > > On Aug 6, 2012, at 5:03 PM, Rost wrote: > > > hi Peter, > > > > Thanks for watching . > > Actually that''s all my service resource without the ensure => running. > Should I use that parameter to have puppet launch my script? > > Here is the content of myinit_script.sh. > > > > #!/bin/sh > > echo "Starting Apache2" > > /opt/apache2/bin/apachectl -f /opt/apache2/conf/httpd -k start > > > > Thanks a lot. > > > > > > Le lundi 6 août 2012 21:39:23 UTC+2, pmbuko a écrit : > > On Aug 6, 2012, at 2:45 PM, Rost wrote: > > > >> Hi everbody !!! > >> > >> I would like to know how to use the parameter start of the service > resource type. Because i want to use my own script to start my service. > >> I have tried 2 cases and did''nt work. > >> > >> Here are the cases : > >> > >> service { ''myservice'': > >> start => ''/root/myinit_script.sh'' > >> } > >> > >> service { ''myservice'': > >> start => "/root/myinit_script.sh" > >> } > >> > >> > >> Do you have any idea on how to use this parameter? > >> > >> Thans very much for help. > > > > Rost, > > > > Is what you pasted about the entire ''myservice'' resource definition or > did you leave our the ''ensure'' lines for brevity? Make sure you have an > ''ensure => running," line in the service definition if you want puppet to > ensure that state. There might also be a problem with your init script. > Can you please post the contents of myinit_script.sh here? > > > > -- > > Peter Bukowinski > > > > -- > > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/o_m0fn9FLnAJ. > > 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. > > -- > Peter > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/8ks300MgZbUJ. 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.
Hi, Depending on your version latest docs are described here: http://docs.puppetlabs.com/references/latest/type.html#service You should specify whether you want the service enabled or not and try to provide a status script so puppet can figure out if the service is already running or not. Also make sure you provide good exit codes on your scripts. Cheers, Den On 07/08/2012, at 4:45, Rost <ynguieye@gmail.com> wrote:> Hi everbody !!! > > I would like to know how to use the parameter start of the service resource type. Because i want to use my own script to start my service. > I have tried 2 cases and did''nt work. > > Here are the cases : > > service { ''myservice'': > start => ''/root/myinit_script.sh'' > } > > service { ''myservice'': > start => "/root/myinit_script.sh" > } > > > Do you have any idea on how to use this parameter? > > Thans very much for help. > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/W1dRjH4ugwoJ. > 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.