Skip to content

Commit

Permalink
* add the pgsql functions to the process controls
Browse files Browse the repository at this point in the history
  • Loading branch information
mitechie committed Jul 24, 2009
1 parent 2935208 commit dbd0e85
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions process_functions.sh
Expand Up @@ -12,6 +12,11 @@
MYSQL_STOP="sudo /etc/init.d/mysql stop > /dev/null"
MYSQL_START="sudo /etc/init.d/mysql start > /dev/null"

# @todo need a much more universal way of doing this...sucks
PGSQL_STOP="sudo /etc/init.d/postgresql-8.3 stop > /dev/null"
PGSQL_START="sudo /etc/init.d/postgresql-8.3 start > /dev/null"


function zprocess_running() {
# $1 should be the process we want to look for
o=$(ps cax | grep -c "$1\$")
Expand Down Expand Up @@ -47,7 +52,55 @@ function zmysql_stop () {
}

# PgSQL
# @todo combine these into one function that we pass start/stop to
function zpgsql_stop () {
zprocess_running 'postgres'
started="$?"

if [ $started -eq 1 ]; then
eval "$PGSQL_STOP"
else
echo "Postgres Not Running"
return 1
fi

# make sure that it's stopped
zprocess_running 'postgres'
started="$?"
if [ $started -eq 1 ]; then
echo "Could not stop Postgres"
return 0
fi

return 1
}

function zpgsql_start () {
zprocess_running 'postgres'
started="$?"

if [ $started -eq 0 ]; then
eval "$PGSQL_START"
else
echo "Postgres Running"
return 1
fi

# make sure that it's running
zprocess_running 'postgres'
started="$?"
if [ $started -eq 0 ]; then
echo "Could not start Postgres"
return 0
fi

return 1
}

# ctags
function zctags () {


}


0 comments on commit dbd0e85

Please sign in to comment.