#!/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. angular源码剖析之Provider系列--QProvider

    QProvider 简介 源码里是这么描述的: A service that helps you run functions asynchronously, and use their return ...

  2. poj3181【完全背包+整数拆分】

    题意: 给你一个数n,在给你一个数K,问你这个n用1-k的数去组合,有多少种组合方式. 思路: 背包重量就是n: 那么可以看出 1-k就是重物,价值是数值,重量是数值. 每个重物可以无限取,问题转化为 ...

  3. CF1059E Split the Tree(倍增)

    题意翻译 现有n个点组成一棵以1为根的有根树,第i个点的点权为wi,需将其分成若干条垂直路径使得每一个点当且仅当被一条垂直路径覆盖,同时,每条垂直路径长度不能超过L,点权和不能超过S,求最少需要几条垂 ...

  4. pip 国内安装镜像源

    转自: https://blog.csdn.net/xuezhangjun0121/article/details/81664260 pip国内的一些镜像   阿里云 http://mirrors.a ...

  5. PHP函数技巧篇

    可变参数 Php提供3个函数用于检索在函数中所传递的参数. $array = func_get_args(); //返回一个提供给函数的所有参数的数组 $count = func_num_args() ...

  6. 微信小程序开发常见的拉起外部地图软件进行导航的功能

    <view class="dh" bindtap="mapNavigation" data-addr="{{address}}"> ...

  7. CoreData修改了数据模型报错 The model used to open the store is incompatible with the one used to create the store

    在iOS 6 – Core Data 应用程序的开发过程中, App启动时出现如下异常信息: reason = “The model used to open the store is incompa ...

  8. iOS7改变状态栏文字颜色

    1在Info.plist中设置UIViewControllerBasedStatusBarAppearance 为NO2 在需要改变状态栏颜色的 AppDelegate中在 didFinishLaun ...

  9. Linux下mysql新建账号及权限设置各种方式总结

    来自:http://justcoding.iteye.com/blog/1941116 1.权限赋予 说明:mysql部署在服务器A上,内网上主机B通过客户端工具连接服务器A以进行数据库操作,需要服务 ...

  10. 利用lsof去查看Unix/Linux进程打开了哪些文件

    利用lsof去查看Unix/Linux进程打开了哪些文件 今天用了一下lsof,发现这个linux的小工具,功能非常强大而且好用. 我们可以方便的用它查看应用程序进程打开了哪些文件或者对于特定的一个文 ...