Thanks for the reply.<br><br>This is something that I had tried as well, however, the format of the file ends up looking like the following:<br><br><a href="http://cpploupoi09.my.domain.com.au">cpploupoi09.my.domain.com.au</a><a href="http://cpqavggd09.my.domain.com.au/" target="_blank"></a><br>
<a href="http://1cabloupoi08.my.domain.com.au">1cabloupoi08.my.domain.com.au</a><br> <a href="http://1cacloupoi07.my.domain.com.au">1cacloupoi07.my.domain.com.au</a><br> <a href="http://1cadloupoi06.my.domain.com.au">1cadloupoi06.my.domain.com.au</a><br>
<a href="http://1caeloupoi05.my.domain.com.au">1caeloupoi05.my.domain.com.au</a><br> <a href="http://1cafloupoi06.my.domain.com.au">1cafloupoi06.my.domain.com.au</a><br> 1<br><br>Thanks for HUP signal part. I will use the system() function to send the command.<br>
<br>Any other hints in relation to the previous item?<br><br><br><div class="gmail_quote">2009/3/27 Mathew Robertson <span dir="ltr"><<a href="mailto:mathew.robertson@netratings.com.au">mathew.robertson@netratings.com.au</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<font size="+1"><tt>print UPDATE "$_\t1"<br>
<br>
<br>
"ps auxww" will give you a process list, from which you can get the
PID, so that you can call "kill -HUP <PID>"<br>
<br>
Hope this helps,<br>
Mathew Robertson<br>
</tt></font><br>
Camillo Pereira wrote:
<blockquote type="cite"><div><div></div><div class="h5">Hi,<br>
<br>
I have the following scenario where I need to extract node name
information based on certain conditions from an application, and write
the data out to a file and HUP the process concerned. I have managed
to get to a certain point however need some advise.<br>
<br>
Script output:<br>
<br>
#!/usr/bin/perl<br>
use strict;<br>
use warnings;<br>
<br>
## Cut down version of regex list<br>
<br>
my @critical_device_def = (<br>
[AAA => qr{...apb09} ],<br>
[BBB => qr{...avggd09} ],<br>
[CCC => qr{...uytwop09} ],<br>
[DDD => qr{...loupoi09} ]<br>
<br>
); <br>
<br>
my @DEVICE_LIST;<br>
my $file = "rules.txt";<br>
my @tokens;<br>
<br>
open(UPDATE, ">$file") || die "Can't open new file: $!\n";<br>
<br>
@DEVICE_LIST=`/opt/OV/bin/ovtopodump | awk '\$3 ~
/^[a-z]+.*\.my\.domain\.com\.au/{print \$3}'| uniq`;<br>
<br>
foreach (@DEVICE_LIST)<br>
{ <br>
for my $t (@critical_device_def)<br>
{<br>
my ($site, $device, $flag) = @$t;<br>
if ($_ =~ m/\G($device)/gc) <br>
{<br>
<br>
print UPDATE "$_" ;<br>
next;<br>
}<br>
<br>
}<br>
<br>
}<br>
<br>
=====<br>
<br>
The problem I am having is that at the print UPDATE line, I need to
append to the data a tab and the number 1. With the current code, the
file output looks like this:<br>
<br>
<a href="http://cpploupoi09.my.domain.com.au" target="_blank">cpploupoi09.my.domain.com.au</a><br>
<a href="http://cpqavggd09.my.domain.com.au" target="_blank">cpqavggd09.my.domain.com.au</a><br>
<br>
however, I need the contents to be printed to the file in the format
below where the hostname then a tab and the number one is printed:<br>
<br>
<a href="http://cpploupoi09.my.domain.com.au" target="_blank">cpploupoi09.my.domain.com.au</a>
<tab_space> 1<br>
<a href="http://cpqavggd09.my.domain.com.au" target="_blank">cpqavggd09.my.domain.com.au</a>
<tab_space> 1<br>
<br>
What is the best way to do this?<br>
<br>
Also what is the best way to send a HUP signal to a running Unix
process?<br>
<br>
Appreciate your help.<br>
<br>
</div></div><pre><hr size="4" width="90%">
_______________________________________________
Melbourne-pm mailing list
<a href="mailto:Melbourne-pm@pm.org" target="_blank">Melbourne-pm@pm.org</a>
<a href="http://mail.pm.org/mailman/listinfo/melbourne-pm" target="_blank">http://mail.pm.org/mailman/listinfo/melbourne-pm</a></pre>
</blockquote>
</div>
</blockquote></div><br>