Wednesday, March 28, 2012

Scheduling perl scripts with sqlagent

SQL2K SP3a Win2k Pro SP4
Probably one for people using perl for scripting.
I'm having a problem scheduling perl scripts to run with sql agent.
All permissions are OK, PERL5LIB is set and the script will run perfectly
from the command line
When running through sql agent the following:
cmd /c "perl s:\production\getdbspaceused.pl"
It seems it won't pick up the PERL5LIB environment variable. Any ideas,
(without explicitly putting the path to the modules directory) or am I going
to have to use windows scheduler'
I've got task scheduler to run this (but i want the success/failure
notification available from sql agent)
TIA.
KevinI use ActivePerl from www.activestate.com, and have never
had any problem scheduling a Perl script via SQLServer
Agent, though I use Windows Task Scheduler more often to
run Perl scripts. If you have ActivePerl installed on the
server, you can just run a Perl script as (plus whatever
command line switches you may have) using an Operating
System Command job step type.
perl yourScript.pl
perl.exe should already be on the system path.
Linchi
>--Original Message--
>SQL2K SP3a Win2k Pro SP4
>Probably one for people using perl for scripting.
>I'm having a problem scheduling perl scripts to run with
sql agent.
>All permissions are OK, PERL5LIB is set and the script
will run perfectly
>from the command line
>When running through sql agent the following:
> cmd /c "perl s:\production\getdbspaceused.pl"
>It seems it won't pick up the PERL5LIB environment
variable. Any ideas,
>(without explicitly putting the path to the modules
directory) or am I going
>to have to use windows scheduler'
>I've got task scheduler to run this (but i want the
success/failure
>notification available from sql agent)
>
>TIA.
>Kevin
>
>.
>|||Hello Kevin,
Could you please try to run cmd /c "perl s:\production\getdbspaceused.pl"
using xp_cmdshell in the Query Analyser ?
Does that work without any problem ? If yes, you might want to create a Job
to run the same cmd and that way you can use the
SQL Agent successs/failure notifications.
Honestly, I have no experience with running the PERL scripts, but just
wanted to see if above works. Please let me know.
Thanks for using MSDN Managed Newsgroups.
Vikrant Dalwale
Microsoft SQL Server Support Professional
This posting is provided "AS IS" with no warranties, and confers no rights.
Get secure !! For info, please visit http://www.microsoft.com/security.
Please reply to Newsgroups only.
--
| From: <KJGNews@.hotmail.com>
| Subject: Scheduling perl scripts with sqlagent
| Date: Wed, 21 Jan 2004 09:21:02 -0000
| Lines: 24
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OTbE$9$3DHA.1428@.TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.server
| NNTP-Posting-Host: 62.190.182.219
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.sqlserver.server:325288
| X-Tomcat-NG: microsoft.public.sqlserver.server
|
| SQL2K SP3a Win2k Pro SP4
|
| Probably one for people using perl for scripting.
|
| I'm having a problem scheduling perl scripts to run with sql agent.
|
| All permissions are OK, PERL5LIB is set and the script will run perfectly
| from the command line
|
| When running through sql agent the following:
| cmd /c "perl s:\production\getdbspaceused.pl"
|
| It seems it won't pick up the PERL5LIB environment variable. Any ideas,
| (without explicitly putting the path to the modules directory) or am I
going
| to have to use windows scheduler'
|
| I've got task scheduler to run this (but i want the success/failure
| notification available from sql agent)
|
|
| TIA.
| Kevin
|
|
||||Thanks everybody for the help.
I came in this morning and the job has run, successfully and I don't know
why, although
I'm happy about this. Can only assume it took a period of time before the
environment
variable was recognised by the OS?
Anyway, thanks once again.
"Vikrant V Dalwale [MSFT]" <vikrantd@.online.microsoft.com> wrote in message
news:AZhoRpJ4DHA.3648@.cpmsftngxa07.phx.gbl...
>
> Hello Kevin,
> Could you please try to run cmd /c "perl s:\production\getdbspaceused.pl"
> using xp_cmdshell in the Query Analyser ?
> Does that work without any problem ? If yes, you might want to create a
Job
> to run the same cmd and that way you can use the
> SQL Agent successs/failure notifications.
> Honestly, I have no experience with running the PERL scripts, but just
> wanted to see if above works. Please let me know.
> Thanks for using MSDN Managed Newsgroups.
> Vikrant Dalwale
> Microsoft SQL Server Support Professional
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Get secure !! For info, please visit http://www.microsoft.com/security.
> Please reply to Newsgroups only.
> --
> | From: <KJGNews@.hotmail.com>
> | Subject: Scheduling perl scripts with sqlagent
> | Date: Wed, 21 Jan 2004 09:21:02 -0000
> | Lines: 24
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | Message-ID: <OTbE$9$3DHA.1428@.TK2MSFTNGP12.phx.gbl>
> | Newsgroups: microsoft.public.sqlserver.server
> | NNTP-Posting-Host: 62.190.182.219
> | Path:
>
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
> phx.gbl!TK2MSFTNGP12.phx.gbl
> | Xref: cpmsftngxa07.phx.gbl microsoft.public.sqlserver.server:325288
> | X-Tomcat-NG: microsoft.public.sqlserver.server
> |
> | SQL2K SP3a Win2k Pro SP4
> |
> | Probably one for people using perl for scripting.
> |
> | I'm having a problem scheduling perl scripts to run with sql agent.
> |
> | All permissions are OK, PERL5LIB is set and the script will run
perfectly
> | from the command line
> |
> | When running through sql agent the following:
> | cmd /c "perl s:\production\getdbspaceused.pl"
> |
> | It seems it won't pick up the PERL5LIB environment variable. Any ideas,
> | (without explicitly putting the path to the modules directory) or am I
> going
> | to have to use windows scheduler'
> |
> | I've got task scheduler to run this (but i want the success/failure
> | notification available from sql agent)
> |
> |
> | TIA.
> | Kevin
> |
> |
> |
>

No comments:

Post a Comment