Hi, basically i have script and when i run the script its open a port and listen on that port. I know i can use augeas to add entry into /etc/services but i am not using xiented . is there any way to to find out if the port is running or not (10049) and if the port is not running then force the script to run ?? Thanks Kind Regards -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Create a fact that gives you the port status “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "Virtual_user" <fosiul@gmail.com> To: puppet-users@googlegroups.com Sent: Wednesday, August 28, 2013 11:05:07 AM Subject: [Puppet Users] Run a script if port is not running Hi, basically i have script and when i run the script its open a port and listen on that port. I know i can use augeas to add entry into /etc/services but i am not using xiented . is there any way to to find out if the port is running or not (10049) and if the port is not running then force the script to run ?? Thanks Kind Regards -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Hi Other then custom facts is not there any other way ?? Fosiul. On Wednesday, August 28, 2013 4:22:43 PM UTC+1, Ygor wrote:> > Create a fact that gives you the port status > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > > ------------------------------ > *From: *"Virtual_user" <fos...@gmail.com <javascript:>> > *To: *puppet...@googlegroups.com <javascript:> > *Sent: *Wednesday, August 28, 2013 11:05:07 AM > *Subject: *[Puppet Users] Run a script if port is not running > > Hi, > basically i have script and when i run the script its open a port and > listen on that port. > > I know i can use augeas to add entry into /etc/services but i am not using > xiented . > > is there any way to to find out if the port is running or not (10049) > and if the port is not running then force the script to run ?? > > Thanks > Kind Regards > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com <javascript:>. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Fosiul, You are probably better off using your init or service management system to achieve this. Puppet isn''t really designed to run often enough to reliably keep your script running. I would solve this with a simple systemd service file, using the Restart=always. Use Puppet to install the script and service file and to enable and start the systemd service. I believe that Upstart can automatically restart services as well, but I don''t have experience using it that way. It would seem that the real problem is that you are using SysV Init, which cannot automatically restart a service on failure. Frankly Puppet agent runs are too slow and consume too many resources to play watchdog. You could solve this with an exec resource that does command => ''netstat -ltn | grep -qv PORT_NUMBER && SCRIPT'' Cheers, Justin On Wed, Aug 28, 2013 at 10:25 AM, Virtual_user <fosiul@gmail.com> wrote:> Hi > Other then custom facts is not there any other way ?? > Fosiul. > > On Wednesday, August 28, 2013 4:22:43 PM UTC+1, Ygor wrote: >> >> Create a fact that gives you the port status >> >> “Sometimes I think the surest sign that intelligent life exists elsewhere >> in the universe is that none of it has tried to contact us.” >> Bill Waterson (Calvin & Hobbes) >> >> ________________________________ >> From: "Virtual_user" <fos...@gmail.com> >> To: puppet...@googlegroups.com >> >> Sent: Wednesday, August 28, 2013 11:05:07 AM >> Subject: [Puppet Users] Run a script if port is not running >> >> Hi, >> basically i have script and when i run the script its open a port and >> listen on that port. >> >> I know i can use augeas to add entry into /etc/services but i am not using >> xiented . >> >> is there any way to to find out if the port is running or not (10049) >> and if the port is not running then force the script to run ?? >> >> Thanks >> Kind Regards >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to puppet-users...@googlegroups.com. >> To post to this group, send email to puppet...@googlegroups.com. >> >> Visit this group at http://groups.google.com/group/puppet-users. >> For more options, visit https://groups.google.com/groups/opt_out. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
You can most likely use an exec with an ''onlyif'' parameter with netstat or lsof. But like other people are posting, probably better off as a service. Let me know if you figure out the exact exec onlyif command you used, would be good to know. exec { "run_account_purger": command => "/usr/local/sbin/account_purger", onlyif => "grep -c old_account /etc/passwd", } On Wednesday, August 28, 2013 11:05:07 AM UTC-4, Virtual_user wrote:> > Hi, > basically i have script and when i run the script its open a port and > listen on that port. > > I know i can use augeas to add entry into /etc/services but i am not using > xiented . > > is there any way to to find out if the port is running or not (10049) > and if the port is not running then force the script to run ?? > > Thanks > Kind Regards > > >-- _____________________________________________________ This email and any files transmitted with it are confidential and intended solely for the addressee. If you received this email in error, please do not disclose the contents to anyone; kindly notify the sender by return email and delete this email and any attachments from your system. © 2011 Currensee Inc. is a member of the National Futures Association (NFA) Member ID 0403251 | Over the counter retail foreign currency (Forex) trading may involve significant risk of loss. It is not suitable for all investors and you should make sure you understand the risks involved before trading and seek independent advice if necessary. Performance, strategies and charts shown are not necessarily predictive of any particular result and past performance is no indication of future results. Investor returns may vary from Trade Leader returns based on slippage, fees, broker spreads, volatility or other market conditions. Currensee Inc | 54 Canal St 4th Floor | Boston, MA 02114 | +1.617.624.3824 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.