Thread: windows 2008 scheduled task problem

windows 2008 scheduled task problem

From
"Ralph Dell"
Date:

I am running postgresql 8.4.3/ postgis 1.5 on a windows server 2008 R2

I am unable to get the shp2pgsql command to run as scheduled tasks. There is no problem running any of the commands from the command line or a python script.

 

Some sample commands are

 

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

%POSTGIS_PATH%\shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy  | psql –d mydb –U xxx –q

 

I do not get any output from the scheduled task.

 

The history tab in the task scheduler will show Task triggered/ task started / task completed, and report the task successfully completed.

I am running the tasks under a system administrator account.

 

Any suggestions from someone who has a similar environment.

 

This is my first post to the list and I hope it is an appropriate place for the question I and I have provided enough detail.

 

Ralph Dell

 

Re: windows 2008 scheduled task problem

From
Susan Cassidy
Date:

See my reply below:

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ralph Dell
Sent: Monday, February 06, 2012 8:26 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] windows 2008 scheduled task problem

 

I am running postgresql 8.4.3/ postgis 1.5 on a windows server 2008 R2

I am unable to get the shp2pgsql command to run as scheduled tasks. There is no problem running any of the commands from the command line or a python script.

 

Some sample commands are

 

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

%POSTGIS_PATH%\shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy  | psql –d mydb –U xxx –q

 

I do not get any output from the scheduled task.

 

The history tab in the task scheduler will show Task triggered/ task started / task completed, and report the task successfully completed.

I am running the tasks under a system administrator account.

 

Any suggestions from someone who has a similar environment.

 

This is my first post to the list and I hope it is an appropriate place for the question I and I have provided enough detail.

 

Ralph Dell

 

I don’t know about Win 2008, but under XP, I have to use the full path of any programs I have in scheduled job.

 

Susan

Re: windows 2008 scheduled task problem

From
Richard Sickler
Date:
Ralph,

It may help to break this into a couple of parts
Make a folder called c:\cronjobs
in c:\cronjobs create a bat file that contains the commands you want executed.

Maybe something like

set logfile=shp2pgsql.log
echo Running shp2pgsql > %logfile%
date /t >> %logfile%
time /t >> %logfile%
shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

Get everything working as expected when you invoke the bat file. Once you have that working, then setup scheduled tasks to call the bat file.

Rich

On Mon, Feb 6, 2012 at 8:42 AM, Susan Cassidy <scassidy@edgewave.com> wrote:

See my reply below:

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ralph Dell
Sent: Monday, February 06, 2012 8:26 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] windows 2008 scheduled task problem

 

I am running postgresql 8.4.3/ postgis 1.5 on a windows server 2008 R2

I am unable to get the shp2pgsql command to run as scheduled tasks. There is no problem running any of the commands from the command line or a python script.

 

Some sample commands are

 

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

%POSTGIS_PATH%\shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy  | psql –d mydb –U xxx –q

 

I do not get any output from the scheduled task.

 

The history tab in the task scheduler will show Task triggered/ task started / task completed, and report the task successfully completed.

I am running the tasks under a system administrator account.

 

Any suggestions from someone who has a similar environment.

 

This is my first post to the list and I hope it is an appropriate place for the question I and I have provided enough detail.

 

Ralph Dell

 

I don’t know about Win 2008, but under XP, I have to use the full path of any programs I have in scheduled job.

 

Susan


Re: windows 2008 scheduled task problem

From
"Ralph Dell"
Date:

 

 

Ralph Dell, GISP

GIS Dept.

Catawba County, NC

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Richard Sickler
Sent: Monday, February 06, 2012 12:04 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] windows 2008 scheduled task problem

 

Ralph,

It may help to break this into a couple of parts
Make a folder called c:\cronjobs
in c:\cronjobs create a bat file that contains the commands you want executed.

Maybe something like

set logfile=shp2pgsql.log
echo Running shp2pgsql > %logfile%
date /t >> %logfile%
time /t >> %logfile%
shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

Get everything working as expected when you invoke the bat file. Once you have that working, then setup scheduled tasks to call the bat file.

Rich

On Mon, Feb 6, 2012 at 8:42 AM, Susan Cassidy <scassidy@edgewave.com> wrote:

See my reply below:

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ralph Dell
Sent: Monday, February 06, 2012 8:26 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] windows 2008 scheduled task problem

 

I am running postgresql 8.4.3/ postgis 1.5 on a windows server 2008 R2

I am unable to get the shp2pgsql command to run as scheduled tasks. There is no problem running any of the commands from the command line or a python script.

 

Some sample commands are

 

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

%POSTGIS_PATH%\shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy  | psql –d mydb –U xxx –q

 

I do not get any output from the scheduled task.

 

The history tab in the task scheduler will show Task triggered/ task started / task completed, and report the task successfully completed.

I am running the tasks under a system administrator account.

 

Any suggestions from someone who has a similar environment.

 

This is my first post to the list and I hope it is an appropriate place for the question I and I have provided enough detail.

 

Ralph Dell

 

I don’t know about Win 2008, but under XP, I have to use the full path of any programs I have in scheduled job.

 

Susan

 

Re: windows 2008 scheduled task problem - Solved

From
"Ralph Dell"
Date:

I don’t want to admit how many times I have revisited this but I have some preliminary tests working.

 

My test server is XP and I just reconfirmed that there are no issues getting the scheduled task to run on that box pretty easily.

 

On the windows server 2008 the following looks like it will work  as a scheduled task

 

cd  %POSTGIS_PATH%

shp2pgsql -s 900913 -I -d c:\\PostgreSQL\\data\\test6.shp gis.test6 -u xxx -p yyy | psql -d mydb -U xxx –q

 

where %POSTGIS_PATH% is the path to my postgreSQL /bin folder, and my data is residing  on the local computer

When my data was on another server shp2pgsql did not give me any output, and the task also failed if I moved my shp2pgsql and/or psql to another folder.

 

From the command line I did not have any issues. I did not have to cd to the /bin folder and my data could reside remote server.

 

Ralph Dell

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Richard Sickler
Sent: Monday, February 06, 2012 12:04 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] windows 2008 scheduled task problem

 

Ralph,

It may help to break this into a couple of parts
Make a folder called c:\cronjobs
in c:\cronjobs create a bat file that contains the commands you want executed.

Maybe something like

set logfile=shp2pgsql.log
echo Running shp2pgsql > %logfile%
date /t >> %logfile%
time /t >> %logfile%
shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

Get everything working as expected when you invoke the bat file. Once you have that working, then setup scheduled tasks to call the bat file.

Rich

On Mon, Feb 6, 2012 at 8:42 AM, Susan Cassidy <scassidy@edgewave.com> wrote:

See my reply below:

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ralph Dell
Sent: Monday, February 06, 2012 8:26 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] windows 2008 scheduled task problem

 

I am running postgresql 8.4.3/ postgis 1.5 on a windows server 2008 R2

I am unable to get the shp2pgsql command to run as scheduled tasks. There is no problem running any of the commands from the command line or a python script.

 

Some sample commands are

 

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

%POSTGIS_PATH%\shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy > myshape.txt

or

shp2pgsql -s 900913 -I -d myshape.shp gis.myshape -u xxx -p yyy  | psql –d mydb –U xxx –q

 

I do not get any output from the scheduled task.

 

The history tab in the task scheduler will show Task triggered/ task started / task completed, and report the task successfully completed.

I am running the tasks under a system administrator account.

 

Any suggestions from someone who has a similar environment.

 

This is my first post to the list and I hope it is an appropriate place for the question I and I have provided enough detail.

 

Ralph Dell

 

I don’t know about Win 2008, but under XP, I have to use the full path of any programs I have in scheduled job.

 

Susan