Initial cdb_geocoder_server commit

This commit is contained in:
Guido Fioravantti
2015-11-06 17:22:39 +01:00
parent c2640cf51d
commit 0297214c53
10 changed files with 123 additions and 2 deletions
+2
View File
@@ -0,0 +1,2 @@
-- Complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION cdb_geocoder_server" to load this file. \quit
+19
View File
@@ -0,0 +1,19 @@
-- Check if a given host is up by performing a ping -c 1 call.
CREATE OR REPLACE FUNCTION check_host(hostname TEXT)
RETURNS BOOLEAN
AS $$
import os
response = os.system("ping -c 1 " + hostname)
return False if response else True
$$ LANGUAGE plpythonu VOLATILE;
-- Returns current pwd
CREATE OR REPLACE FUNCTION pwd()
RETURNS TEXT
AS $$
import os
return os.getcwd()
$$ LANGUAGE plpythonu VOLATILE;