Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHb3x-0005uW-Fl for pgsql-general@arkaria.postgresql.org; Tue, 30 Oct 2018 20:56:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHb3v-0003PD-8c for pgsql-general@arkaria.postgresql.org; Tue, 30 Oct 2018 20:56:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHb3u-0003O7-T6 for pgsql-general@lists.postgresql.org; Tue, 30 Oct 2018 20:56:31 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHb3s-0001or-3z for pgsql-general@postgresql.org; Tue, 30 Oct 2018 20:56:29 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5E99E22094; Tue, 30 Oct 2018 16:56:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 30 Oct 2018 16:56:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=t VMxaR/e6d5guPr/aH2uY8/+gMDpnCZKfhQAXuxODO0=; b=AiRadHR27qwMXe93R K2U6xoH8dL/D6NGyYE7mNQ0MZZcN3jHW99TAowkXcr7gD01eBBOzaldY/DYYm8ug +jYpbol7fSjIhB9LyElYe2xSqlN18e7Nr7q3jzNe9jQHZxBBfVUzJBVbmiIz2hA2 yIdlqz17KRjGkHRuuEF+bsnlYFImUJZALE/RhTlz21fT3BokOX0dE1OGYsxqv912 gtjW4lFF/5OfGNfx+kzG61b5a0I9jEBmE86LzzM8cqVkRgeKXjqafSpiA6k62KpJ t72h0c7/h41iORjxN3VU9Y8rV2Z20qHpDvH8Nv6jOjb/kU+EXdvRl5N40Dfaxx0B eDdHw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=tVMxaR/e6d5guPr/aH2uY8/+gMDpnCZKfhQAXuxOD O0=; b=AENQBF6EhXp+ShlaR3y8v/yillLZ47S+P3Ygl1e+iGX3pk/FLTi0XAN4m AHaaS9dF877Vb0Z8sZAXe1dxvxZSpvLuf6bfD96zQ382UgZwQuu6qgZSJ7DhD2Uu b6x9ciGbegXBhC0d6t/7sjz0PMWGoZ0IM/GuUjhzudCgHO6rT4+W9jCP2OxwZl7X VFvDMMxiHvTH7Av+VlA8TjUMOyVuNTnLY7JxOuYeu0A6plQUztNkBvY6DJ0sLAas h2aBKMGRBuhnEcc/xdyq1mn/OCidj91c66AZQpU2d9Q6U8h0gJ857PCBePXgX/oq YyQVZne/AkWKbuElVgmucb0yWPMRw== X-ME-Sender: X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 815D2E4696; Tue, 30 Oct 2018 16:56:26 -0400 (EDT) Subject: Re: Question about servicescript for stopping and starting postgresql instance To: Marian Forums Cc: pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: Date: Tue, 30 Oct 2018 13:56:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: 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 On 10/30/18 9:27 AM, Marian Forums wrote: > Hi Adrain, > Thanks for your reply. How was Postgres installed on this machine? Have you tried the script from the docs? > My script looks like this: I am no systemd expert, still the Type=forking does not seem right to me. > # cat /usr/lib/systemd/system/postgresql-9.6.pg-tstxxx.service > [Unit] > Description=postgresql_pg-tstxxx > After=syslog.target > After=network.target > > [Service] > Type=forking > User=postgresql > Group=postgresqlg > Environment=PGDATA=/data/pg-tstxxx/data-01/ > # Run ExecStartPre with root-permissions > PermissionsStartOnly=true > ExecStartPre=/bin/chown postgresql:postgresqlgroup /var/run/postgresql > ExecStart=/usr/pgsql-9.6/bin/pg_ctl start -D ${PGDATA} > ExecStop=/usr/pgsql-9.6/bin/pg_ctl stop -D ${PGDATA} -s -m fast > ExecReload=/usr/pgsql-9.6/bin/pg_ctl reload -D ${PGDATA} -s > Restart=on-failure > KillMode=control-group > ExecStop=/bin/kill -SIGTERM $MAINPID > RestartSec=10s > > [Install] > WantedBy=multi-user.target > > thanks in advance. > regards, > Marian > > Op di 30 okt. 2018 om 14:30 schreef Adrian Klaver > >: > > On 10/30/18 5:09 AM, Marian Forums wrote: > > Hi, > > > > I have a question about creating a service script to > start/stop/status > > postgresql instance ( version 9.6.8) on Red Hat 7. > > How did you install Postgres on the machine? > > > > > I have read the explanation of how to create such a service > script on > > https://www.postgresql.org/docs/9.6/static/server-start.html . > > Did you use the example at the above link or did you write your own? > > If you wrote your own can you show it? > > > > > > Stopping and Starting works. > > However when I stop the service with: > > systemctl stop postgresq.service and than ask for the status with > > systemctl status postgresql.service, the service gets started again. > > > > Is this normal functionality on Red Hat 7? > > I have searched on the Internet ( including the Red Hat site) for a > > parameter to replace this behavior, but did not find anything. > > > > Your help is much appreciated. > > Thanks in advance. > > Regards, > > Marian > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com