Mailing List Archive

Running a perl script in an AT job
I'm trying to run a perl script from inside of a WIndows NT AT job, but I
don't seem to be having any luck. There are no errors listed, but the
script does not seem to do anything.

*** The batch job (test.bat):

rem Test perl in a batch job
perl test.pl

*** The perl script (test.pl):

print "Running test script\n";

*** The AT command:

at 16:00 "c:\temp\test.bat > c:\temp\test.log"

*** The batch job output (test.log):

h:\>type c:\temp\test.log

C:\WINNT35\system32>rem Test perl in a batch job

C:\WINNT35\system32>perl test.pl

Even if I change the batch job to route the perl output to a file:

rem Test perl in a batch job
perl test.pl > test.txt

the file TEST.TXT will be created, but empty. Oh yes, my SYSTEM PATH variable
is:

PATH=%SystemRoot%\system32;%SystemRoot%;C:\RESKIT35\;H:\MSTOOLS\bin;\\miura\
perl-nt\bin

The last entry is where perl is located. Does the problem have to do with
AT jobs and network connections?
--------------
Mike Frederick, University of Houston, Academic Support
mike@uh.edu
Re: Running a perl script in an AT job [ In reply to ]
I suggest adding a "cd MyDir" line to your batch file to ensure that
it's connected to the directory you expect.

rem *** set the current dir
c:
cd \mydir

rem *** run the script
perl test.pl

----------------------------------------------------------------
Keith S. Kiyohara Tel (310)449-4253
kkiyohara@symantec.com Fax (310)449-7629
RE: Running a Perl script in an AT job [ In reply to ]
Message-ID: red-50-msg951121193720MTP[01.51.00]000000bb-1256

Since you are using a UNC path in your path environment variable, the
Schedule service must be logged in with net permissions. Therefore, you
have to change Control Panel.Services.Schedule.Start Up.Log In As to a
user who has the ability to access the "miura" server.

Brad Thompson.

----------
| From: Mike Frederick <mike@uh.edu>
| To: <ntperl@mail.hip.com>
| Subject: Running a perl script in an AT job
| Date: Tuesday, November 21, 1995 10:01AM
|
| I'm trying to run a perl script from inside of a WIndows NT AT job, but I
| don't seem to be having any luck. There are no errors listed, but the
| script does not seem to do anything.
|
| *** The batch job (test.bat):
|
| rem Test perl in a batch job
| perl test.pl
|
| *** The perl script (test.pl):
|
| print "Running test script\n";
|
| *** The AT command:
|
| at 16:00 "c:\temp\test.bat > c:\temp\test.log"
|
| *** The batch job output (test.log):
|
| h:\>type c:\temp\test.log
|
| C:\WINNT35\system32>rem Test perl in a batch job
|
| C:\WINNT35\system32>perl test.pl
|
| Even if I change the batch job to route the perl output to a file:
|
| rem Test perl in a batch job
| perl test.pl > test.txt
|
| the file TEST.TXT will be created, but empty. Oh yes, my SYSTEM PATH
variable
| is:
|
| PATH=%SystemRoot%\system32;%SystemRoot%;C:\RESKIT35\;H:\MSTOOLS\bin;\\miura\
| perl-nt\bin
|
| The last entry is where perl is located. Does the problem have to do with
| AT jobs and network connections?
| --------------
| Mike Frederick, University of Houston, Academic Support
| mike@uh.edu
|
Re: Running a perl script in an AT job [ In reply to ]
At 10:01 21/11/95 -0600, Mike Frederick wrote:
>
>PATH=%SystemRoot%\system32;%SystemRoot%;C:\RESKIT35\;H:\MSTOOLS\bin;\\miura\
>perl-nt\bin
>
>The last entry is where perl is located. Does the problem have to do with
>AT jobs and network connections?

If your Scheduler Service is running as a System Account, the Scheduler will
only have Guest access to the network. It may be necessary to start the
Scheduler Service as a User which has proper network access.

Also, you can try to execute your script as follows

at 16:00 "c:\temp\test.bat > c:\temp\test.log 2>&1"

which will re-direct standard error to test.log. This may give you more
information.


Paddy,
+--------------------------------------------------------------------+
| E-Mail: paddy@innet.lu, burke@e-mail.com, 72660.147@compuserve.com |
| Home Page: http://www.innet.lu/~pub00095 |
+--------------------------------------------------------------------+
| Hashing.... For Drinkers with a Running problem......GDH3....On On |
+--------------------------------------------------------------------+
Re[2]: Running a perl script in an AT job [ In reply to ]
Another important point is that the Schedule Service changed under 3.51.
From the System Guide/Update Information for Version 3.51:

"The command interpreter, cmd, is no longer loaded by default
when running the schedule service. However, certain commands, for
example, dir, copy, and > or >> (redirection) do not work without
cmd."

So to get redirection to work you have to:

at 14:30 "cmd /c test.cmd >test.log"

In addition you also need to be aware:

1) The batch job is logged on as the System account unless you have changed
it via Control Panel/Services/Startup. This means the User Environment
Variables will be whatever is assigned to System.

2) The default connected dir for your batch job will be
%SystemRoot%\system32.

I found this out after sending mike corrections to my previous semi-bogus
advice :(

----------------------------------------------------------------
Keith S. Kiyohara Tel (310)449-4253
kkiyohara@symantec.com Fax (310)449-7629
Re[2]: Running a perl script in an AT job [ In reply to ]
Another important point is that the Schedule Service changed under 3.51.
From the System Guide/Update Information for Version 3.51:

"The command interpreter, cmd, is no longer loaded by default
when running the schedule service. However, certain commands, for
example, dir, copy, and > or >> (redirection) do not work without
cmd."

So to get redirection to work you have to:

at 14:30 "cmd /c test.cmd >test.log"

In addition you also need to be aware:

1) The batch job is logged on as the System account unless you have changed
it via Control Panel/Services/Startup. This means the User Environment
Variables will be whatever is assigned to System.

2) The default connected dir for your batch job will be
%SystemRoot%\system32.

I found this out after sending mike corrections to my previous semi-bogus
advice :(

----------------------------------------------------------------
Keith S. Kiyohara Tel (310)449-4253
kkiyohara@symantec.com Fax (310)449-7629