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 1gHbIr-0006fk-B9 for pgsql-general@arkaria.postgresql.org; Tue, 30 Oct 2018 21:11:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHbIp-0007Fi-G0 for pgsql-general@arkaria.postgresql.org; Tue, 30 Oct 2018 21:11:55 +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 1gHbIp-0007FJ-3v for pgsql-general@lists.postgresql.org; Tue, 30 Oct 2018 21:11:55 +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 1gHbIi-00028q-5T for pgsql-general@postgresql.org; Tue, 30 Oct 2018 21:11:53 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 504D321F54; Tue, 30 Oct 2018 17:11:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 30 Oct 2018 17:11:47 -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=m U/FiPmlkYi1kkar8c2TBAoYZJSyKXsNdU8CNWCeH5o=; b=bGSt82+lH8zqSS8Vj wCTI9nOLuWsgWDXpvIvP9Y+yqz8bDjAmb+1tFOph45J5tcGjtXteA0k2gQFLSVfY iuRnet1vjCpuVBACjl/mT33S3kRS9x+VjQGKs1yT62TqeqXc9a5BaR2UXleDXrPl 2TfTXzKnQOTG3+Dhl7S8WW2O2Gh9x0d+aKbt8weAnvcezhKAavF3c4NaO+R6h1Z5 GNPcPTDLAGBwWHNu4FDwZ5S6oVdkdUg8Dj74TE3JJlmEYHeI60Yt7a47ZBXU6X62 rSHtHKpxfwaZD0CgHXz+ohshTyvondXeiu4fcVg3I8jeEEeM+SkI+pN0hhdkYFAE 6wOyw== 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=mU/FiPmlkYi1kkar8c2TBAoYZJSyKXsNdU8CNWCeH 5o=; b=v7NkwGnRgUsKiiyUJ4nleujZv9IbhpXwGN/vSK48LTxx/Y0DOSFSRC9qB x/bS3djDUGc+et372uY792/HrT67Bc8gzKQCm+FMe9HWkjU9HPKYq5uOLNI+cpk2 r6hz+7ciKCYOLZl1bN4C+1OO+VaBBVpmjNsD4d+bUQyhwmatc9SkRrlC+FO/3YQN HuxoRejUjslHuAhbZw6PoXh9qpE14qlDgmnqfG+1xaI+EPz7YVZuoBsgAPqgjqyE 6jTufF+2Q50192yN0OBSA65giuR6AwyuEHlRb9T+/ZvsQ3U6H7LJZMs7sJMmQb0g Ud68lyZc9OdAfEdtBjkToheAt2yvg== 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 838E0E49C5; Tue, 30 Oct 2018 17:11:46 -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: <80a02c4b-0ab8-4a1e-fa6a-d4f0a961d079@aklaver.com> Date: Tue, 30 Oct 2018 14:11:45 -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 2:09 PM, Marian Forums wrote: > > > Hi, > Postgres was installed through a repo with yum install. So did you disable the start/stop scripts that the package installed? > I will try to run it with another type. > Regards > Marian > >> Op 30 okt. 2018 om 21:56 heeft Adrian Klaver het volgende geschreven: >> >>> 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 -- Adrian Klaver adrian.klaver@aklaver.com