running a Windows process from Perl as my user
- Hi everyone,
When I started learning perl, I was working on a unix machine. Now I work at a company that uses Microsoft software. I am therefore using ActiveState's ActivePerl. I need to parse some webserver logs and send the data to a database. I wrote a script that did this, but it was kinda slow, probably due to my writing it ineffeciently. So, instead, I used a tool called LogParser, which was blazingly fast on Microsoft-formatted webserver logs.
I call this program from the command line, such as "logparser file1 dosomestuff goToDatabase" and it does what I need. However, I need to do this to about 1000 gzipped logs and therefore need to use perl to do it.
So my program:
- copies a given logfile to a new directory
- gunzips it
- runs logparser and spits out the data to the db
- deletes unzipped copy
- repeats for all logfiles in directory
It works. The only problem, and what keeps it from being at all useful, is that when I use system("command here") or backticks (`command here`) in the perl script to launch a dos window to run the logparser command, the process runs as Perl, with the user being "system" and in this way I am denied access to the database (I cannot make an ODBC connection).
I tried all the different options with logparser, from using a connection string, to providing separate user/password parameters, to using a dsn, and all work if I run the command from the command line, but none work if I use perl to execute the command.
Is there any way to say "when spawning a new process, run this perl command as user X" with windows? If it was unix, I could just do something like
`su betterUser logparser file1 dosomestuff goToDatabase`;
but of course that doesn't work with Windows...
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
[Non-text portions of this message have been removed]