Centos7下源编译安装Postgresql 并设置开机自动启动postgresql.serivce 服务相关研究

编写开机自动启动服务脚本:
# cat >> /usr/lib/systemd/system/postgresql.service >> EOF
[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
添加可执行权限:
chmod 754 /usr/lib/systemd/system/postgresql.service
设置为开机自启动:
systemctl enable postgresql.service
常用指令(以postgresql服务为例):
启动某服务:
systemctl start postgresql.service
停止某服务:
systemctl stop postgresql.service
重启某服务:
systemctl restart postgresql.service
service postgresql restart
使某服务自动启动(如tomcat服务):
systemctl enable postgresql.service
使某服务不自动启动:
systemctl disable postgresql.service
检查服务状态:
systemctl status postgresql.service (服务详细信息)
systemctl is-active postgresql.service(仅显示是否Active)
显示所有已启动的服务:
systemctl list-units --type=service
Centos7下源编译安装Postgresql 并设置开机自动启动postgresql.serivce 服务相关研究的更多相关文章
- CentOS7 下源码安装 python3
CentOS 7 下源码安装 python3 在CentOS7下,默认安装的是python2.7:为满足项目要求,安装python3 的方法如下: 1. 首先安装python3.6可能使用的依 ...
- centos下安装memcached并设置开机自动启动-两种方法
方法一: 安装memcachedyum install memcached 启动服务并初始化service memcached start -p 11211 -l 127.0.0.1 -d 设置mem ...
- CentOS7下源码安装mysql5.6
目录 准备工作 运行环境 确认你的安装版本 下载mysql 安装mysql 准备安装环境 编译和安装 配置mysql 单实例配置 单实例配置方法 添加防火墙 ...
- 源码编译安装nginx及设置开机启动项
1.上传nginx文档:解压到/data目录下,并安装依赖包tar xf nginx-1.20.1.tar.gz -C /data/cd /data/nginx-1.20.1/ && ...
- centos7下源码安装mysql5.7.16
一.下载源码包下载mysql源码包 http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.16.tar.gz 二.安装约定: 用户名:mysql 安装目录 ...
- CentOS7下源码安装5.6.23
清理CentOS7下的MariaDB. [root@localhost ~]#rpm -qa | gremp mariadb [root@localhost ~]# rpm -e --node ...
- centos7下源码安装多个nginx步骤完整版
1.下载:wget http://nginx.org/download/nginx-1.10.0.tar.gz 解压:tar -zxvf nginx-1.10.0.tar.gz 2. 执行下面 ...
- Windows 下安装redis 并且设置开机自动启动的过程.
1. 下载redis 的 windows下的安装文件 https://github.com/MicrosoftArchive/redis/releasesmsi文件下载地址https://github ...
- Linux下源码安装MySQL-5.6.25
从mysql-5.5起,mysql源码安装开始使用cmake了,因此我们得先安装cmake,配置安装目录./configure --perfix=/.....的时候和以前的会有些区别. 一.安装cma ...
随机推荐
- 【常用工具】vagrant的box哪里下?镜像在哪儿找?教你在vagrant官网下载各种最新.box资源
进入vagrant官网 : https://www.vagrantup.com/ 点击findbox[寻找box],进入有很多box的列表 : https://app.vagrantup.com/bo ...
- Poj 2109 k^n = p.
Poj2109(1)和Poj2109(2)这两种解答都是有漏洞的,就是解不一定存在. 当然这种漏洞的存在取决于出题人是否假设输入的n,p必须默认有kn = p这样的关系存在. 这道题可以详细看http ...
- canvas锥形渐变进度条
从一个渐变圆角进度条浅出画一个圆 开始 这一切需要从一个(简单)的需求开始,在最开始对设计第一眼看到这张图的时候,感觉挺简单的嘛,直接用echarts饼图模拟出来一个就好了 echarts 然后上ec ...
- python argparse总结
python2.7废除optparse,原因:http://code.google.com/p/argparse/ 说了半天好像是重开了个小号练级 抓紧写下来一会又得忘了 用法: import arg ...
- Spring boot Sample 009之spring-boot-web-thymeleaf
一.环境 1.1.Idea 2020.1 1.2.JDK 1.8 二.目的 spring boot 整合thymeleaf模板开发web项目 三.步骤 3.1.点击File -> New Pro ...
- 【算法】单元最短路径之Bellman-Ford算法和SPFA算法
SPFA是经过对列优化的bellman-Ford算法,因此,在学习SPFA算法之前,先学习下bellman-Ford算法. bellman-Ford算法是一种通过松弛操作计算最短路的算法. 适用条件 ...
- Java-接口概念辨析
https://mp.weixin.qq.com/s/HQZhlS-ffgEMqhB2rHax1w 1. 类 是属性成员和方法成员的集合:2. 父类 是子类相同属性成员和方法成 ...
- Linux(六)文件系统
个人博客网:https://wushaopei.github.io/ (你想要这里多有) 一.根目录内容 1.概述 Linux系统中只有一个文件系统,以“/”作为根目录,从根目录出发可以找到任何 ...
- Java实现 洛谷 P1064 金明的预算方案
题目描述 金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间金明自己专用的很宽敞的房间.更让他高兴的是,妈妈昨天对他说:"你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过NN元 ...
- Java实现 蓝桥杯 算法训练 Cowboys
试题 算法训练 Cowboys 问题描述 一个间不容发的时刻:n个牛仔站立于一个环中,并且每个牛仔都用左轮手枪指着他旁边的人!每个牛仔指着他顺时针或者逆时针方向上的相邻的人.正如很多西部片那样,在这一 ...