Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmURk-0002OS-KV for pgsql-general@arkaria.postgresql.org; Thu, 24 Jan 2019 02:08:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gmURi-0006hj-En for pgsql-general@arkaria.postgresql.org; Thu, 24 Jan 2019 02:08:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmURi-0006hc-1b for pgsql-general@lists.postgresql.org; Thu, 24 Jan 2019 02:08:46 +0000 Received: from mail.twelvemountain.com ([54.203.247.157]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gmURf-0005JN-5o for pgsql-general@lists.postgresql.org; Thu, 24 Jan 2019 02:08:44 +0000 Received: from [192.168.1.2] (wsip-72-196-86-131.ph.ph.cox.net [72.196.86.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: ajm) by mail.twelvemountain.com (Postfix) with ESMTPSA id BD8A72D56 for ; Wed, 23 Jan 2019 19:00:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.twelvemountain.com; s=mail; t=1548295241; bh=bJ52XQ/surxwck47yu4U32AJaH20HadeZ2P55hf06eA=; h=To:From:Subject:Date:From; b=HuCJuvm2ygvMvgibhKmk/fx2pe1Gv6B9T0z8JKzQKmRPpHfn0ohXRLo5sM+zIoXH5 34eqT2n7J5THuMwALrC/IVRxMa4ukLIP65gciCZu3Egh3a87rkyr7DzZ8KxfAFoubx K3PBBs/AltFHaGuJkad1RcUKa9QUSWbk5TDLv80Q= To: pgsql-general@lists.postgresql.org From: Alex Morris Subject: how to properly start postgresql with no TCP listeners in ubuntu 16.04 LTS Message-ID: <985c8553-4543-8b73-d455-0813873147d6@twelvemountain.com> Date: Wed, 23 Jan 2019 19:08:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Greetings, This question may simply be my ignorance of what piece of the systemd / systemctl puzzle needs attention. Any clues are appreciated. Using postgreSQL version 9.5 as obtained from ubuntu repo. Install was fine. initdb and subsequent database use is fine. Nothing is out of the ordinary except me being able to alter how postgres starts on boot (eg how postgres is called by init scripts or systemd ). I wish to start postgres on boot with no TCP listeners, only unix-domain sockets. I can achieve this goal by executing the following command as postgres user in a normal terminal session; postgres -D /space/postgres -h '' -c listen_addresses='' Starting the database in this manner results in stdout and stderr from postgres to show up in the terminal and not the default log file, but I can fix that. Stopping the database cleanly when started in the above manner requires user postgres to give 'pg_ctl stop' command in another terminal. Of course I can press ctrl-C in the terminal it was started from, and it dies.. I can also achieve the no TCP socket goal using a pg_ctl command, as postgres in a terminal; pg_ctl start -D /space/postgres -o '-h "" -c listen_addresses=""' where in the pg_ctl command, the single quotes protect the double quotes, which are placeholders for the empty parameter values needing to be passed to the actual postgres command.. I thought I could edit the postgresql.service / postgresql@.service files and use the systemctl method. I have not yet discovered a way to pass the needed options and empty quotes, or any "special character" (special as seen by systemd I guess when reading in postgresql*.service files..) into the startup process. Postgres will start but it's the default install values, and not my needed command line. Seems like there ought to be a way to do what I need. I just haven't found it yet. Suggestions on what systemctl magic fruits or other system startup tool needs attention are most welcome. Thanks in advance, alex