zoukankan      html  css  js  c++  java
  • Centos7下源编译安装Postgresql 并设置开机自动启动postgresql.serivce 服务相关研究

    编写开机自动启动服务脚本:

    # cat >> /usr/lib/systemd/system/postgresql.service >> EOF

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    [Unit]
    Description=PostgreSQL database server
    After=network.target
     
    [Service]
    Type=forking
     
    User=postgres
    Group=postgres
     
    # Port number for server to listen on
    Environment=PGPORT=5432
     
    # Location of database directory
    Environment=PGDATA=/usr/local/pgsql9.4/data
     
    # Where to send early-startup messages from the server (before the logging
    # options of postgresql.conf take effect)
    # This is normally controlled by the global default set by systemd
    # StandardOutput=syslog
     
    # Disable OOM kill on the postmaster
    OOMScoreAdjust=-1000
     
    #ExecStartPre=/usr/local/pgsql9.4/bin/postgresql-check-db-dir ${PGDATA}
    ExecStart=/usr/local/pgsql9.4/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
    ExecStop=/usr/local/pgsql9.4/bin/pg_ctl stop -D ${PGDATA} -s -m fast
    ExecReload=/usr/local/pgsql9.4/bin/pg_ctl reload -D ${PGDATA} -s
     
    # Give a reasonable amount of time for the server to start up/shut down
    TimeoutSec=300
     
    [Install]
    WantedBy=multi-user.target

    EOF

    添加可执行权限:

    1
    chmod 754 /usr/lib/systemd/system/postgresql.service

    设置为开机自启动:

    1
    systemctl enable postgresql.service

    常用指令(以postgresql服务为例):

    启动某服务: 

    1
    systemctl  start  postgresql.service

    停止某服务:

    1
    systemctl stop postgresql.service

    重启某服务:

    1
    2
    systemctl restart postgresql.service
    service postgresql restart

    使某服务自动启动(如tomcat服务):

    1
    systemctl enable postgresql.service

    使某服务不自动启动:

    1
    systemctl disable postgresql.service

    检查服务状态:

    1
    2
    systemctl   status  postgresql.service (服务详细信息)
    systemctl   is-active postgresql.service(仅显示是否Active)

    显示所有已启动的服务:

    1
    systemctl   list-units --type=service
     
  • 相关阅读:
    Opencv3 Robert算子 Sobel算子 拉普拉斯算子 自定义卷积核——实现渐进模糊
    Opencv3 形态学操作
    Opencv3 图片膨胀与腐蚀
    opencv3 图片模糊操作-均值滤波 高斯滤波 中值滤波 双边滤波
    Realsense D430 python pointclound
    opencv3读取视频并保存为图片
    Opencv3 Mat对象构造函数与常用方法
    掩膜
    Opencv图像变成灰度图像、取反图像
    ubuntu16.04 安装openpose
  • 原文地址:https://www.cnblogs.com/telwanggs/p/12665228.html
Copyright © 2011-2022 走看看