Sponsored Content
Full Discussion: file is getting overwritten
Top Forums Shell Programming and Scripting file is getting overwritten Post 302446281 by arundhati_s on Wednesday 18th of August 2010 07:09:04 AM
Old 08-18-2010
Thanks Ranjithpr and ctaylor.

I find the second suggestion better because it executes the query in one go. Thanks a lot for your help Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

.cshrc and .login overwritten !!

Hi, My account is : abcd I belong to a group: pqrs Some thing straneg happened yesterday. My .cshrc and .login got overwritten into pqrs's .cshrc and .login I obviously did not explicitly overwrite pqrs's .cshrc. Are there any reasons how this could have happened indirectly due to... (5 Replies)
Discussion started by: gjthomas
5 Replies

2. UNIX for Dummies Questions & Answers

Grub Loader entry overwritten

Hello, One of my frend had a problem. He had Windows XP installed on his system. Then he installed Red Hat Linux 8.0 in one of the partitions. After some time his XP got corrupt and then he reinstalled Windows XP. This over wrote the Grub loader entry, and due to this the grub loader is not... (2 Replies)
Discussion started by: rahulrathod
2 Replies

3. AIX

UIDs being overwritten immediately

We have a problem where we delete a user and their associated UID gets dumped back in the UID pool. The if we immediately create a another (new) user, AIX reuses the last UID, the one that was just released. This is causing a problem when reports are being generated because the new users name is... (2 Replies)
Discussion started by: xsys2000
2 Replies

4. SCO

Overwritten /dev/root -recovery of SCO OpenServer 5.0.4

Due to my own stupidity I managed to overwrite my /dev/root device using dd (don't ask). Current state is - Have current backup created using cpio (command used was 'find . -mount -depth -print|cpio -ocB > $TAPE') - Once I realised what was happening powered off the server but this was too... (2 Replies)
Discussion started by: ok2
2 Replies

5. HP-UX

Critical files in /etc overwritten EMPTY!

The following files were wiped out - new empty files were left in their place. /etc/inittab, /etc/inetd.conf, and /etc/MANPATH The system is running HP-UX 11i v3 - Mar08. Anyone seen anything like this? Any ideas on a way to figure this out if it happens again or a suggested way to... (9 Replies)
Discussion started by: KEnglander
9 Replies

6. UNIX for Advanced & Expert Users

Data Recovery from file system overwritten with LVM.

Hey peeps, Here is somethin u might find interestin.... Is it possible to recover data from a partition which used to be an ext3 file sytem with some nice forgotten backups, which now is an lvm partion containg root partition of another OS. :) I couldn't create any mess better than this, can... (2 Replies)
Discussion started by: squid04
2 Replies

7. Solaris

overwritten rootdisk?

Hi, The dump device on my system was set to /dev/dsk/c0t0d0s7. I have done a savecore -Lv on the system which worked fine. I'm wondering have I overwritten the rootdisk here by mistake? The system is still up but will need to be rebooted due to an error on it. Will it come back up? ... (8 Replies)
Discussion started by: gwhelan
8 Replies

8. Programming

variables overwritten

Hi, i have some problems with the following code: char *tab_path; char *sep=" \t\n"; char line; char *p; FILE * file; int i = 0; if(fgets(line,MAXLINE,file)!=NULL){ if((p=strtok(line,sep))!=NULL)tab_path=p; while((p=strtok(NULL,sep))!=NULL){ i++; ... (4 Replies)
Discussion started by: littleboyblu
4 Replies

9. Shell Programming and Scripting

How to preserve the value of a variable from being overwritten?

Hi All, I am new new to unix.com, I have a question related to shell scripting. We have a Oracle database backup shell script, which can be used for taking full, incremental & archive log backup based on the parameters passed. Within the script we export a variable as export... (5 Replies)
Discussion started by: veeresh_15
5 Replies

10. UNIX for Advanced & Expert Users

Ssh2 key has been overwritten, need a way to restore

I had generated a ssh2 key on my AIX box, to receive files from other AIX and Linux systems. Key Name: id_ssh2_server.pub However this ssh2 key (both public and private keys) has been overwritten, while I was generating another ssh2 key. Now the earlier configured target systems are not able... (3 Replies)
Discussion started by: freakygs
3 Replies
Log::Handler::Output::DBI(3pm)				User Contributed Perl Documentation			    Log::Handler::Output::DBI(3pm)

NAME
Log::Handler::Output::DBI - Log messages to a database. SYNOPSIS
use Log::Handler::Output::DBI; my $db = Log::Handler::Output::DBI->new( # database source database => "database", driver => "mysql", host => "127.0.0.1", port => 3306, # or with "dbname" instead of "database" dbname => "database", driver => "Pg", host => "127.0.0.1", port => 5432, # or with data_source data_source => "dbi:mysql:database=database;host=127.0.0.1;port=3306", # Username and password user => "user", password => "password", # debugging debug => 1, # table, columns and values (as string) table => "messages", columns => "level ctime cdate pid hostname progname message", values => "%level %time %date %pid %hostname %progname %message", # table, columns and values (as array reference) table => "messages", columns => [ qw/level ctime cdate pid hostname progname message/ ], values => [ qw/%level %time %date %pid %hostname %progname %message/ ], # table, columns and values (your own statement) statement => "insert into messages (level,ctime,cdate,pid,hostname,progname,message) values (?,?,?,?,?,?,?)", values => [ qw/%level %time %date %pid %hostname %progname %message/ ], # if you like persistent connections and want to re-connect persistent => 1, ); my %message = ( level => "ERROR", time => "10:12:13", date => "1999-12-12", pid => $$, hostname => "localhost", progname => $0, message => "an error here" ); $db->log(\%message); DESCRIPTION
With this output you can insert messages into a database table. METHODS
new() Call "new()" to create a new Log::Handler::Output::DBI object. The following options are possible: data_source Set the dsn (data source name). You can use this parameter instead of "database", "driver", "host" and "port". database or dbname Pass the database name. driver Pass the database driver. host Pass the hostname where the database is running. port Pass the port where the database is listened. user Pass the database user for the connect. password Pass the users password. table and columns With this options you can pass the table name for the insert and the columns. You can pass the columns as string or as array. Example: # the table name table => "messages", # columns as string columns => "level, ctime, cdate, pid, hostname, progname, message", # columns as array columns => [ qw/level ctime cdate pid hostname progname message/ ], The statement would created as follows insert into message (level, ctime, cdate, pid, hostname, progname, mtime, message) values (?,?,?,?,?,?,?) statement With this option you can pass your own statement if you don't want to you the options "table" and "columns". statement => "insert into message (level, ctime, cdate, pid, hostname, progname, mtime, message)" ." values (?,?,?,?,?,?,?)" values With this option you have to set the values for the insert. values => "%level, %time, %date, %pid, %hostname, %progname, %message", # or values => [ qw/%level %time %date %pid %hostname %progname %message/ ], The placeholders are identical with the pattern names that you have to pass with the option "message_pattern" from Log::Handler. %L level %T time %D date %P pid %H hostname %N newline %C caller %p package %f filename %l line %s subroutine %S progname %r runtime %t mtime %m message Take a look to the documentation of Log::Handler for all possible patterns. persistent With this option you can enable or disable a persistent database connection and re-connect if the connection was lost. This option is set to 1 on default. dbi_params This option is useful if you want to pass arguments to DBI. The default is set to { PrintError => 0, AutoCommit => 1 } "PrintError" is deactivated because this would print error messages as warnings to STDERR. You can pass your own arguments - and overwrite it - with dbi_params => { PrintError => 1, AutoCommit => 0 } debug With this option it's possible to enable debugging. The information can be intercepted with $SIG{__WARN__}. log() Log a message to the database. my $db = Log::Handler::Output::DBI->new( database => "database", driver => "mysql", user => "user", password => "password", host => "127.0.0.1", port => 3306, table => "messages", columns => [ qw/level ctime message/ ], values => [ qw/%level %time %message/ ], persistent => 1, ); $db->log( message => "your message", level => "INFO", time => "2008-10-10 10:12:23", ); Or you can connect to the database yourself. You should notice that if the database connection lost then the logger can't re-connect to the database and would return an error. Use "dbi_handle" at your own risk. my $dbh = DBI->connect(...); my $db = Log::Handler::Output::DBI->new( dbi_handle => $dbh, table => "messages", columns => [ qw/level ctime message/ ], values => [ qw/%level %time %message/ ], ); connect() Connect to the database. disconnect() Disconnect from the database. validate() Validate a configuration. reload() Reload with a new configuration. errstr() This function returns the last error message. PREREQUISITES
Carp Params::Validate DBI your DBI driver you want to use EXPORTS
No exports. REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. If you send me a mail then add Log::Handler into the subject. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-11-21 Log::Handler::Output::DBI(3pm)
All times are GMT -4. The time now is 11:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy