Changeset 795

Show
Ignore:
Timestamp:
08/08/07 06:48:13
Author:
dokai
Message:

Make sure the db server is down before proceeding.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • buildout/pcl.buildout/trunk/init_postgresql.py

    r793 r795  
    2323        raise RuntimeError('Error running command: %s' % cmd) 
    2424 
    25 if os.path.exists(wrapper_script): 
     25PIDFILE = '%s/postmaster.pid' % PGDATA 
     26if os.path.exists(wrapper_script) and os.path.exists(PIDFILE): 
     27    print 'Shutting down PostgreSQL server...' 
    2628    system('%s stop' % wrapper_script) 
     29    while os.path.exists(PIDFILE): 
     30        time.sleep(1) 
    2731 
    2832# Clean up existing parts 
     
    3034    shutil.rmtree(PGDATA) 
    3135 
     36assert not os.path.exists(PGDATA) 
    3237os.makedirs(PGDATA) 
    3338 
     
    5055# Create a database and import the world borders data set into the db 
    5156# for testing 
    52  
    5357system('%s/bin/shp2pgsql -I -s 4269 %s postgis.world_borders > /tmp/wb.sql' % (POSTGIS, DATASET)) 
    5458system('%s/bin/createdb --port=%s %s' % (PGROOT, PGPORT, PGDBNAME))