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 ...
随机推荐
- Django认证系统之自带auth_user表操作
Django自带auth_user表操作: views.py from django.contrib import auth#引入auth模块 from django.contrib.auth.m ...
- Kubeedge-mapper 实现
应用场景: 利用GitHub上的温度传感器的例子作为讲解,实现从云端获取设备终端状态及使用Java模拟设备数据.其实和官网给的视频一样,只需要将终端设备的数据转换为支持MQTT协议传输的数据,云端就可 ...
- H3C S5500V2交换机误格式化恢复
一.格式化后,bin文件及视图全部被删除需要联系H3C客服报交换机后面的序列号,然后根据工单中给你的账号密码去H3C官网下载对应的软件包. 二.下载3CDaemon使用TFTP方式将解压出来的.ipe ...
- 王玉兰201771010128《面向对象与程序设计(Java)》第十一周学习总结
一:理论知识部分: (1)集合:集合(Collection或称为容器)是一种包含多个元素并提供对所包含元素操作方法的类,其包含的元素可以由同一类型的对象组成,也可以由不同类型的对象组成. A:集合类的 ...
- CF832D
题目链接:http://codeforces.com/contest/832/problem/D 题目大意:在一个无向图上,给出三个点,以其中一个点为终点,另外两个点为起点,请问如何安排起点和终点可以 ...
- Java流程控制以及顺序、选择、循环结构
目录 用户交互Scanner Scanner对象 hasNext()与next() hasNextLine()与nextLine() Scanner进阶用法 求和与平均数 顺序结构 选择结构 if单选 ...
- 重学 Java 设计模式:实战建造者模式
作者:小傅哥 博客:https://bugstack.cn - 原创系列专题文章 沉淀.分享.成长,让自己和他人都能有所收获! 一.前言 乱码七糟 [luàn qī bā zāo],我时常怀疑这个成语 ...
- CF1353D Constructing the Array(优先队列)
Question 给你一个长度为n的全为0的序列,让你从1-n填数,填的位置为找出最长的0序列,如序列长度为奇数,则为(l+r)/2,为偶数,则为(l+r-1)/2 Solution 运用优先队列,将 ...
- Win2003远程桌面突然无法连接,有没有解决方法?
在日常工作中,运维人员除了接触服务器监控工具外,最常用的应该就是远程桌面了吧.iis7远程桌面是一款绿色小巧的服务器管理工具,更加人性化,管理服务器更是不可测量. 可以管理1000台服务器的远程桌面: ...
- win10和centos7双系统双磁盘引导的实现
win10和centos7双系统双磁盘引导的实现1.背景:dell5460笔记本电脑M2-120G固态盘无法在bios中引导,新装了M360G固态盘后,考虑把120G固态盘安装centos7.5系统做 ...