Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8987731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:51:44+00:00 2026-06-15T21:51:44+00:00

I built this deployment script which runs when my debian 6.0 server is deployed.

  • 0

I built this deployment script which runs when my debian 6.0 server is deployed. I have shown it here before (this is a linode stackscript incase anyone else is wondering):

#!/bin/bash
#
# Install PostgreSQL
#
# Copyright (c) 2010 Filip Wasilewski <en@ig.ma>.
#
# My ref: http://www.linode.com/?r=aadfce9845055011e00f0c6c9a5c01158c452deb

function postgresql_install {
    aptitude -y install postgresql postgresql-contrib postgresql-dev libpq-dev
}

function postgresql_create_user {
    # postgresql_create_user(username, password)
    if [ -z "$1" ]; then
        echo "postgresql_create_user() requires username as the first argument"
        return 1;
    fi
    if [ -z "$2" ]; then
        echo "postgresql_create_user() requires a password as the second argument"
        return 1;
    fi

    echo "CREATE ROLE $1 WITH LOGIN ENCRYPTED PASSWORD '$2';" | sudo -i -u postgres psql
}

function postgresql_create_database {
    # postgresql_create_database(dbname, owner)
    if [ -z "$1" ]; then
        echo "postgresql_create_database() requires database name as the first argument"
        return 1;
    fi
    if [ -z "$2" ]; then
        echo "postgresql_create_database() requires an owner username as the second argument"
        return 1;
    fi

    sudo -i -u postgres createdb --owner=$2 $1
}

postgresql_install
postgresql_create_user(username, password)
postgresql_create_database(dbname, username)

I deployed my server with this script, which was built on top of Filip’s version, but then when I try to see if postgresql is running by typing pg_ctl it says command not found.

Where I have I gone wrong on this? Since it deploys when the server runs I am not able to see where it is going wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:51:45+00:00Added an answer on June 15, 2026 at 9:51 pm

    As people say it looks like you don’t have the PostgreSQL bin directory on your path. In my experience on Ubuntu with PostgreSQL 9.1/9.2 on install from apt, the postgres user is created but it doesn’t properly set up your environment, so pg_ctl and initdb etc are not on your PATH.

    I can’t see what PostgreSQL version you’re using, but my 9.1 & 9.2 instances store the binaries in /usr/lib/postgresql/9.2/bin

    Check that directory to see if it contains pg_ctl and other binaries. If it does,

    try running:

    export PATH=$PATH:/usr/lib/postgresql/9.2/bin
    

    and see if that allows you to run pg_ctl. If so, you’ll need to execute that at login from .bashrc or similar

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this $data array: (built on a shell, not a form) (debugged here)
I built this simple script to input a certain number, Now I want to
I have built this accordion using the jquery ui accordion plugin, I sort of
I have a multi-step order form built in this manner: Step 1: Choose category
I have a page with an unordered list built like this: <ul id='shows'> <div
I have an HTML table containing a few rows (this is built dynamically). All
I have a NAnt script that does a build and deployment of an ASP.Net
I've built a set of generic deployment scripts which work great for the majority
I have a MSBuild build/deployment script that, as part of it's routine, stops and
So, I've built this navigation bar so far and I'm curious if it's even

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.