Re: Issues with creating a shell script.
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Mon, 16 Oct 2006 17:48:14 -0400
On 2006-10-16, cephalon wrote:
Chris F.A. Johnson wrote:
How is it called? With what argument?
What is the script? Please include enough context from previous
posts so that one doesn't have to go searching for them (they
might not even be available).
IIRC, there was a suggestion to use printf instead of echo; have
you tried that?
Essentially, what I am trying to create is an external script that will
write its input
What input? Are you providing an argument on the command line, or
expecting to get it from the standard input? (If no message is
supplied to logger, it will read the standard input.)
to a file (among other actions), when called. The data
passed to the script would be something along the lines of:
(Name: Check Point administrator credential guessing; RuleID:
{F182D6BC-A0AA-444a-9F31-C0C22ACA2114}; Uuid:
<42135c9c,00000000,2e1510ac,131c07b6>; NumOfUpdates: 0; IsLast:
0; StartTime: 16Feb2005 16:45:45; EndTime: Not Completed;
DetectionTime: 16Feb2005 16:45:48; LastUpdateTime: 0;
TimeInterval: 600; MaxNumOfConnections: 3; TotalNumOfConnections:
3; DetectedBy: 2886735150; Origin: (IP: 1.2.3.4; repetitions: 3;
countryname: United States; hostname: theHost) ; ProductName:
SmartDashboard; User: XYZ; Source: (hostname: theHost;
repetitions: 3; IP: 1.2.3.4; countryname: United States) ;
Severity: Critical; EventNumber: EN00000184; State: 0;
NumOfRejectedConnections: 0; NumOfAcceptedConnections: 0) ;
I tried the printf suggestion, and no <pid>LOG file was created. The
current script essentially looks like this:
printf printf "%s\n" "$1" >$$LOG
That should be:
printf "%s\n" "$1" >$$LOG
logger $1
The output is written correctly to syslog, but printf creates no file.
Originally the first line was /bin/echo $1 > $$LOG, and the <pid>LOG
file was created, but nothing was written to it.
$1 is the first argument to the script. Are you supplying one?
I think that what you really want is:
tee $$log | logger
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
.
- References:
- Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: Chris Mattern
- Re: Issues with creating a shell script.
- From: cephalon
- Re: Issues with creating a shell script.
- From: Chris F.A. Johnson
- Re: Issues with creating a shell script.
- From: cephalon
- Issues with creating a shell script.
- Prev by Date: Re: USB Scanner GNU/Linux Tool
- Next by Date: Re: USB Scanner GNU/Linux Tool
- Previous by thread: Re: Issues with creating a shell script.
- Next by thread: Re: Issues with creating a shell script.
- Index(es):
Relevant Pages
|