08-20-2008
Perl: FH and multiple writes
I found this logging subroutine on the net that I want to use but despite trying many things, I cannot figure out how to get the date in front of the logged text. Ideally what I'm looking for is a line that looks something like this:
Wed Aug 20 18:17:29 PDT 2008 - my logging info here.
my $logging= 1;
if($logging){open FILE , " >> ./my.log";}
sub logit{
if ($logging){
# print FILE system("date");
print FILE "$_[0]\n";
}
}
unless (system "/usr/bin/ssh -l username server hostname > /dev/null") {
logit("remote host available");
} else {
logit("remote host NOT available")
};
Any clues on this?
Thanks,
Gary
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone,
Ive got a quick question about the feasibility and any suggestions for a shell script. I can use sh or ksh, doesnt matter. Basically, Ive got an output file from a db2 command that looks like so:
SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS F4 F5 ... (3 Replies)
Discussion started by: rdudejr
3 Replies
2. UNIX for Dummies Questions & Answers
Some process rewrites a file ( i'm hacked :) Can I somehow monitor which process does that? (2 Replies)
Discussion started by: hachik
2 Replies
3. UNIX for Advanced & Expert Users
Gentle readers,
I am trying to observe system behavior on our RHEL 5.2 machines. I notice that, it appears to me, based on random iterations of
dd if=/dev/zero of=/var/tmp/bigfile bs=1024 count=20000
...that if the pdflush is flushing buffers at the time of my write, my write will take... (4 Replies)
Discussion started by: mschwage
4 Replies
4. Solaris
Hi,
Normally, I setup my volumes under Solaris (doesnt matter, 8 or 10),
as vxassist -g dg01 -U gen make vol01 500m dg0101, then I do a mirror
vxassist -g dg01 mirror vol01 dg0102.
Which is legal and does work, however, when the primary dg01 array (or simply in this case, the volume)... (2 Replies)
Discussion started by: mrmurdock
2 Replies
5. Filesystems, Disks and Memory
Hi All
I was wondering how the copying of vast amounts of data affected the overall lifespan of an HDD.
In my example, I'm copying approx 120GB (250,000) of files, once per hour from disk to another.
Is this likely to have a detrimental effect on the disk in terms of reads/writes etc?
... (2 Replies)
Discussion started by: huskie69
2 Replies
6. Solaris
Hey guys
First post... and im not exactly a solaris guru but here goes
Ive setup a solaris 10 box with a raidz2 set of 6 disks...
I have also setup Samba with open shares for some CIFs access...
now my issue is that when i transfer large files to it the network performance contantly... (8 Replies)
Discussion started by: silicoon
8 Replies
7. Shell Programming and Scripting
Hi!
#!/usr/bin/env bash
rm tmpcomm
nc -v -u -l 444 | hexdump -b > tmpcomm
while :
do
read l1 < tmpcomm
read l2 < tmpcomm
read l3 < tmpcomm
read l4 < tmpcomm
# do something
doneI start netcat in the background and listen for an incoming conncetion. All incoming... (1 Reply)
Discussion started by: torax123
1 Replies
8. Solaris
I have a custom auditing class configured for these events but it doesn't seem to be catching it when I do a "echo hey > test.txt" Any ideas on why that is?
---------- Post updated at 06:04 PM ---------- Previous update was at 05:47 PM ----------
Scratch this topic, it looks like it's because... (0 Replies)
Discussion started by: thmnetwork
0 Replies
elcsd(8) System Manager's Manual elcsd(8)
Name
elcsd - error logging daemon
Syntax
/etc/elcsd
Description
The daemon logs hardware and system-related error packets, or error messages, from the kernel errorlog buffer to the file syserr.<host-
name>. Hostname is the name of the local system. At system startup, the daemon is invoked out of For further information, see The daemon
must be running whenever the system is in multiuser mode.
To invoke the daemon in single-user mode, use the command with the -s option.
You can configure the daemon to log error packets locally from a remote ULTRIX host, or you can configure the daemon to send local error
packets to a remote system. Do this by changing the entries in the file. For further information, see The daemon uses an internet data-
gram socket to log information across systems.
Parameters related to such as the desired location for the errorlog file or files, as well as instructions for local and remote logging,
can be specified in the error logging configuration file, For further information, see
Restrictions
You must have superuser privileges to invoke the daemon.
Diagnostics
The daemon logs general status and error messages to in multiuser mode. This file is purged whenever the daemon is restarted.
Files
See Also
elcsd.conf(5), eli(8), rc(8), uerf(8)
Guide to the Error Logger
4th Berkeley Distribution elcsd(8)