生活随笔
收集整理的这篇文章主要介绍了
crontab、chkconfig、systemd、unit、targ
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
2019独角兽企业重金招聘Python工程师标准>>>
10.23 linux任务计划cron
# cat /etc/crontab liunx下的任务计划配置文件crontab -u、-e、-l、-r格式:分 时 日 月 周 user command分范围0-59,时范围0-23,日范文:1-31,月范围:1-12,星期分为:0-6(sunday=0 or 7)# crontab -e进入到任务计划编辑界面0 3 * * * /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log //每个星期,每个月的每天的3点执行命令0 3 1-10 */2 2,5 /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log //每周二周五,双数月份的前10天的3点,执行任务# sytemctl start crond 启动服务# systemctl stop crond //关闭服务# ps aux | grep cron 查看是否有此进程# systemctl status crond查看状态,Actice绿色启动该计划在/var/spool/cron/root(最后是以用户名命名的文件)# cront -l //列出信息# cront -e //编辑# cront -r //删除# cront -u root -l //查看指定用户的计划10.24 Linux系统服务管理-chkconfig工具
# chkconfig --list //当前系统中所有服务 # ls /etc/init.d/# chkconfig network off# chkconfig --level 3 network off //指定某个级别的服务关闭# chkconfig --level 345 network off //指定多个级别的某个服务关闭# chkconfig --del network# chkconfig --add network将脚本放到/etc/init.d/下再将服务add就可以将脚本在某几个级别运行的时候执行了10.25 systemd管理服务
# systemctl list-units --all--type=service几个常用的服务相关的命令 #systemctl enable crond.service //让服务开机启动# systemctl disable crond //让服务开机不启动# systemctl status crod //查看状态# systemctl stop crond //停止服务# systemctl start crond //启动服务# systemctl restart crond //重启服务# systemctl is-enabled crond //检查服务是否开机启动10.26 unit介绍
ls /usr/lib/systemd/system //系统所有unit,分为以下类型:service 系统服务target 多个unit组成的组device 硬件设备mount 文件系统挂载点automount 自动挂载点path 文件或路径scope 不是有systemd启动的外部进程slice进程组snapshot systemd快照socket 进程间通信套接字swap swap文件timer 定时器10.27 target介绍
系统爲了方便管理用target来管理unitsystemctl list-unit-files --type=targetsystemctl list-dependencies multi-user.target //查看指定target下面有哪些unitsystemctl get-default //查看系统默认的targetsystemctl set-default multi-user.target一个service属于一种类型的unit多个unit组成了一个target一个target里面包含了多个servicecat /usr/lib/systemd/system/sshd/service // 看【install】部分扩展
anacron http://blog.csdn.net/strikers1982/article/details/4787226xinetd服(默认机器没有安装这个服务,需要yum install xinetd安装) http://blog.sina.com.cn/s/blog_465bbe6b010000vi.htmlsystemd自定义启动脚本http://www.jb51.net/article/100457.htm
转载于:https://my.oschina.net/u/3803446/blog/1811690
总结
以上是生活随笔为你收集整理的crontab、chkconfig、systemd、unit、targ的全部内容,希望文章能够帮你解决所遇到的问题。
如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。