#!/bin/bash
now=$(date +%Y%m%d)
cmd='/home/hu/go/src/github.com/coredns/coredns/coreserver -conf /home/hu/go/src/github.com/coredns/coredns/Corefile' start(){
exec $cmd &
} stop(){
ps -ef | grep "/home/hu/go/src/github.com/coredns/coredns/coreserver" | grep -v "grep" |awk '{print $2}'| while read pid
do
C_PID=$(ps --no-heading $pid | wc -l)
echo "当前PID=$pid"
if [ $C_PID = "1" ]
then
echo "PID=$pid 准备结束"
kill -9 $pid
echo "PID=$pid 已经结束"
else
echo "PID=$pid 不存在"
fi
done } case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
printf 'Usage: %s {start|stop|restart}\n'"$prog"
exit 1
;;
esac

download shell https://files.cnblogs.com/files/marklove/coredns-manage.zip  

help

http://www.cnblogs.com/boshen-hzb/p/7541901.html

http://www.ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html

https://www.jb51.net/article/136559.htm

http://linux.51yip.com/search/systemctl

https://blog.csdn.net/chwshuang/article/details/68489968

https://www.linuxidc.com/Linux/2015-07/120833.htm

http://manpages.ubuntu.com/manpages/xenial/en/man5/systemd.unit.5.html

https://www.cnblogs.com/dongguolei/p/7902608.html

https://www.cnblogs.com/qiaoyanlin/p/6926981.html

cd /etc/systemd/system

Created     croedns.service

[Unit]
Description = coredns remote control daemon
After = NetworkManager-wait-online.service network.target network-online.target dbus.service
Wants = NetworkManager-wait-online.service network-online.target
Requires = dbus.service [Service]
Type = forking
PIDFile = /var/run/coredns.pid
ExecStart = /home/hu/go/src/github.com/coredns/coredns/coredns -conf /home/hu/go/src/github.com/coredns/coredns/Corefile
Restart = on-abort
StartLimitInterval = 60
StartLimitBurst = 10 [Install]
WantedBy = multi-user.target
Alias = coredns.service

  

sudo systemctl daemon-reload

systemctl disable croedns.service// out

systemctl enable croedns.service

systemctl start croedns.service

systemctl stop croedns.service

systemd-analyze critical-chain croedns.service

reboot

systemctl list-units --failed

nslookup www.baidu.com

ubuntu 18.04 start myproject的更多相关文章

  1. ubuntu 18.04 搭建flask服务器(大合集,个人实操)

    ubuntu 18.04 搭建flask服务器(大合集) Ubuntu python flask 服务器 本次使用的Ubuntu版本为:Ubuntu 18.04.5 LTS (GNU/Linux 4. ...

  2. Ubuntu 18.04 LTS修改 国内源(以中科大源为例)

    国内有很多Ubuntu的镜像源,包括阿里的.网易的,还有很多教育网的源,比如:清华源.中科大源. 我们这里以中科大的源为例讲解如何修改Ubuntu 18.04里面默认的源. 可以进入这个链接进行下载: ...

  3. Ubuntu 18.04 启动root账号并授权远程登录

    Ubuntu 18.04 刚刚上市2个月,下载安装,尝尝鲜~ 安装界面看上去舒服许多, 安装的速度也较之前17.04 和16.04 都快了许多.抱歉,未截图. Ubuntu 安装完成后默认不启动roo ...

  4. Ubuntu 18.04编译AOSP源码

    总结一下我从Ubuntu 18.04下编译成功AOSP的过程,以及遇到的坑 我的电脑配置: OS: Ubuntu 18.04 bionic Kernel: x86_64 Linux 4.18.0-17 ...

  5. Ubuntu 18.04.1 LTS + kolla-ansible 部署 openstack Rocky all-in-one 环境

    1. kolla 项目介绍 简介 kolla 的使命是为 openstack 云平台提供生产级别的.开箱即用的自动化部署能力. kolla 要实现 openetack 部署分为两步,第一步是制作 do ...

  6. Ubuntu 18.04中截图工具Shutter的编辑按钮不可用的解决办法

    Shutter是一个由第三方提供的在Ubuntu上运行的截图工具,相对于系统自带的截图工具(默认可通过Ctrl + Shift + Print快捷键启动截图),最大的优点就是可以即时对图片进行编辑,在 ...

  7. 在Ubuntu 18.04系统上安装Systemback的方法(抄)

    在Ubuntu 18.04系统上安装Systemback的方法 2018-12-26 21:39:05作者:林莉稿源:云网牛站 本文介绍如何在Ubuntu 18.04或者Ubuntu 18.10系统上 ...

  8. Ubuntu 18.04 记录

    登录后死机,关机时死机的解决方法 更新内核并安装 Nvidia 显卡驱动可解决. 在内核更新为 4.15.18,Nvidia 显卡驱动为 390 时,问题解决. 使用 LiveCD 启动,然后 mou ...

  9. 【Ubuntu 18.04 搭建VNC服务器】

    https://www.jianshu.com/p/f58fe5cdeb5f 桌面共享 Ubuntu 18.04自带桌面共享,可以将物理桌面共享给VNC.但是无法创建新的桌面. 具体参考 https: ...

随机推荐

  1. js 将json字符串转换为json对象的方法解析-转

    例如: JSON字符串:var str1 = '{ "name": "cxh", "sex": "man" }'; JS ...

  2. 51nod 1347 【水】

    #include<cstdio> #include <map> #include<iostream> #include<string.h> #inclu ...

  3. bzoj1725: [Usaco2006 Nov]Corn Fields牧场的安排(状压dfs)

    1725: [Usaco2006 Nov]Corn Fields牧场的安排 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 1122  Solved: 80 ...

  4. PostgreSQL - 官方手册、中文手册及Github项目地址

    PostgreSQL每次更新都会有语法变化,低版本的PostgreSQL是无法运行高版本的sql语法的,下边是官方手册地址,可以查看多个版本的: https://www.postgresql.org/ ...

  5. Hexo搭建博客教程(3) - 远程部署到GitHub Pages

    本章讲的是如何将本地的个人项目远程部署到 GitHub Pages,涉及到GitHub的项目仓库.Git的使用,以及Hexo的远程部署等. 1. 安装 hexo-deployer-git 插件 想要将 ...

  6. spring+redis 报错 org.springframework.core.serializer.support.DeserializingConverter.<init>(Ljava/lang/ClassLoader;)V

    这个问题的原因大概就是spring-data-redis.jar包版本不对 ,下面版本可以正常启动 <dependency> <groupId>org.springframew ...

  7. Caffe实战一(环境准备及CPU模式下编译)

    经过前几天的折腾,终于把Ubuntu16.04开发环境给搭建了起来,包括win10+Ubuntu双系统的安装.系统安装后的优化等等. 详见之前的文章:Ubuntu16.04.2 LTS 64bit系统 ...

  8. Random Query CodeForces - 846F

    题目 翻译: 给出一个n个数字的数列a[1],...,a[n],f(l,r)表示使a[l],a[l+1],...,a[r]组成的新序列中的重复元素只保留一个后,剩下元素的数量(如果l>r,则在计 ...

  9. Android设计模式——MVP

    一.什么是MVP MVP:全称 Model-View-Presenter. MVP框架由3部分组成:View层负责显示,Presenter层负责逻辑处理,Model层提供数据. View:负责绘制UI ...

  10. 【转】码云source tree 提交超过100m 为什么大文件推不上去

    码云source tree 提交超过100m 为什么大文件推不上去 2017年01月12日 16:50:51 阅读数:7634 git -c diff.mnemonicprefix=false -c ...