网站首页 包含标签 centos 的所有文章

  • Centos 7如何设置定时重启任务

    1,编辑文件crontab vi /etc/crontab 2,设置重启时间 分时日月年 SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root For details see man 4 crontabs Example of job definition: .---------------- minute (0 - 59) |  .------------- hour (0 - 23) |  |  .---------- day of month (1 - 31) |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ... |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat |  |  |  |  |         * user-name  command to be executed 30 02 * root reboot  #02:30 每天凌晨2点30分重启系统 /6 root reboot  #每隔6小时重启一次 /30 root reboot #每隔30分钟重启一次 30 02 1 root reboot #每月1日02:30 时重启服务器 0 0 /2 root reboot #每2天00点重启一次服务器 3,装载   crontab /etc/crontab 4,定时重启服务   systemctl enable crond.service #开启启动 systemctl restart crond.service #重启服务 systemctl stop crond.service #停止服务 5,查看定时配置   crontab -l 6,查看系统重启情况   who -b  #最近一次重启时间 last reboot  #重启历史     ...

    2022-06-12 354
  • centos7添加虚拟内存[SWAP]

    1.查看内存使用 查看在未增加swap之前虚拟内存的使用情况 free -m Shell  复制 2.创建 swap 文件 使用 dd 命令创建一个 swap 文件, 大小为 2G dd if=/dev/zero of=/home/swap bs=1024 count=2048000 Shell  复制 文件越大,创建的时间越厂 3.转换为 swap 格式 将文件格式转换为 swap 格式的 mkswap /home/swap Shell  复制 4.挂载swap分区 再用swapon命令把这个文件分区挂载swap分区 swapon /home/swap Shell  复制 如果报错:swapon: /home/swap: insecure permissions 0644, 0600 suggested.  修改权限: chmod 600 /home/swap 5.再次查看内存使用 注意观察和1中变化。 free -m Shell  复制 6.设置重启依然有效 为防止重启后swap分区变成0,需要修改/etc/fstab文件: 在文件末尾(最后一行)加上 /home/swap swap swap default 0 0 Shell  复制 7.停用虚拟内存 swapoff -v /home/swap Shell  复制 ...

    2019-08-25 1275

联系我们

在线咨询:点击这里给我发消息

QQ交流群:KirinBlog

工作日:8:00-23:00,节假日休息

扫码关注