摘要: Sleep is a power-saving state that allows a computer to quickly resume full-power operation (typically within several seconds) when you want to start 阅读全文
posted @ 2018-09-12 02:41 孙大花 阅读(897) 评论(0) 推荐(0)
摘要: CentOS 7的电源按钮只有关机和重启两项,但是可以用命令来休眠系统: 重启: $ systemctl reboot 退出系统并停止电源: $ systemctl poweroff 待机: $ systemctl suspend 休眠: $ systemctl hibernate 混合休眠模式(同 阅读全文
posted @ 2018-09-12 02:37 孙大花 阅读(9047) 评论(0) 推荐(0)
摘要: 一、添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为自启动服务 systemctl start jenkins.service #启动jenkins服务 阅读全文
posted @ 2018-09-07 13:52 孙大花 阅读(785) 评论(0) 推荐(0)
摘要: linux下执行.sh文件的方法 .sh文件就是文本文件,如果要执行,需要使用chmod a+x xxx.sh来给可执行权限。 是bash脚本么 可以用touch test.sh #创建test.sh文件 vi test.sh #编辑test.sh文件 加入内容 #!/bin/bash mkdir 阅读全文
posted @ 2018-09-07 13:49 孙大花 阅读(3407) 评论(0) 推荐(0)
摘要: systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。 任务 旧指令 新指令 使某服务自动启动 chkconfig --level 3 httpd on systemctl enable httpd.service 使某服务不自动启动 阅读全文
posted @ 2018-09-07 12:11 孙大花 阅读(207) 评论(0) 推荐(0)
摘要: 1、备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/ CentOS 5 wget -O /etc/yum 阅读全文
posted @ 2018-09-05 15:01 孙大花 阅读(518) 评论(0) 推荐(0)
摘要: 这几天在用supervisor管理爬虫和Flask, 每次都记不住命令,花点时间记录下。 supervisor是一个进程管理工具,用来启动、停止、重启和监测进程。我用这个东西主要用来监测爬虫和Flask运行状况,当程序挂掉后,supervisor能够帮我重新拉起进程。 安装 安装就比较简单了,直接用 阅读全文
posted @ 2018-06-07 11:21 孙大花 阅读(18606) 评论(0) 推荐(1)
摘要: 接触Django这么久了,从来没有好好学习关于Django中的Request和Response对象。借着文件上传下载的相关工作,现在总结一下也不错。 当一个页面请求过来,Django会自动创建一个Request对象,匹配URLconf中对应的view方法,并将这个Request对象作为第一个参数传递 阅读全文
posted @ 2017-09-06 00:31 孙大花 阅读(1226) 评论(0) 推荐(0)
摘要: 这篇文章主要介绍了利用Python中的mock库对Python代码进行模拟测试,mock库自从Python3.3依赖成为了Python的内置库,本文也等于介绍了该库的用法,需要的朋友可以参考下 如何不靠耐心测试 通常,我们编写的软件会直接与那些我们称之为“肮脏的”服务交互。通俗地说,服务对我们的应用 阅读全文
posted @ 2017-08-11 10:09 孙大花 阅读(437) 评论(0) 推荐(0)
摘要: 对于 Python 2.X: import sys reload(sys) sys.setdefaultencoding("utf-8") 1 2 3 对于 <= Python 3.3: import imp imp.reload(sys) 1 2 注意: 1. Python 3 与 Python 阅读全文
posted @ 2017-07-28 07:51 孙大花 阅读(27195) 评论(0) 推荐(4)