at命令發佈的任務計劃
一次性的任務計劃linux
at time ctrl+d 提交
time:
1.絕對時間:12:00
2.相對時間:+8
3.模糊時間:noon midnight teatime
-l:查看任務列表 至關於atq
-d #:從任務列表中撤銷一個任務計劃 至關於atrm
-c #:顯示任務中的命令列表
例:at 11:13
at> mkdir /a/b
at> <EOT> #ctrl+d
job 4 at 2015-11-21 11:13ios
若任務沒有成功執行,會收到郵件,用mail命令讀取vim
at "2:00 2015-12-01"windows
atrm 4 撤銷4號任務
at -d 3 撤銷3號任務bash
cat /etc/sysconfig/atd at的配置文件服務器
date -s "2015-11-21 10:58:00"
可在.bashrc_profile寫入hwclock -s 網絡
crontab命令發佈的任務計劃
週期性任務計劃
系統的週期性任務
/etc/crontabide
cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/
# 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 # | | | | | # * * * * * command to be executed (*表示每一分鐘)
用戶我的的週期任務
crontab
-e:編輯計劃任務 (默認打開vim)
-l:顯示計劃任務
-r:清除計劃任務ui
* * * * * /bin/date +%F > /dev/pts/0 * * * * * echo "hello root" /dev/pts/0 #默認每分鐘執行一次 0 2 10 * * 每個月十號兩點整。修改了時間,週期向上移動一位。肯定數字越多,週期越長 0-10 2 * * * 天天兩點整到兩點10分,一共執行11次 0-10/2 2 * * * 天天兩點整到兩點10分,每兩分鐘執行一次,也就是隔一分鐘執行一次。0分執行,2分執行...
linux系統的啓動
POST-->BIOS-->bootloader-->kernel-->initramfs-->ROOTES-->/sbin/initthis
POST加電自檢
主板上存儲着一段BIOS程序,規定了硬件設備的啓動順序列表,Bootsequence
啓動順序設置爲硬盤優先啓動,爲bios設置密碼
harddisk
CDROM
removable
network
floppy
MBR
Bootloader引導啓動程序,加載kernel
init運行級別
0:關閉系統(不能設置爲默認運行級別)
1:單用戶模式 1 S s
2:多用戶模式,但不支持網絡文件系統
3:徹底的多用戶模式
4:未被使用的、
5:圖形界面
6:從新引導
cat /etc/inittab Default runlevel. The runlevels used are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this)
chkconfig --level 3 crond off
查看當前的運行級別
runlevel
N 3
who -r
run-level 3 2015-05-11 06:07
切換運行級別
init 0
Bootloader引導啓動程序
windows:NTLDR
linux:
LILO:linux loader
GRUB:grand unified bootloader
ls /boot/grub/
device.map ffs_stage1_5 jfs_stage1_5 reiserfs_stage1_5 stage2 xfs_stage1_5
e2fs_stage1_5 grub.conf menu.lst splash.xpm.gz ufs2_stage1_5
fat_stage1_5 iso9660_stage1_5 minix_stage1_5 stage1 vstafs_stage1_5
階段1:保存在MBR裏的446字節
階段1.5:保存在grub目錄中
階段2:磁盤分區
cat /boot/grub/grub.conf
default=0 #默認選擇第一個標題所對應的內核
timeout=5 #當用戶不作出選擇時,默認等待多長時間,單位是秒
若是是0則表示不須要用戶選擇,自動啓動默認的標題
若是是-1則表示除非用戶選擇,不然不會啓動系統
splashimage=(hd0,0)/grub/splash.xpm.gz #啓動界面的背景圖片yum install imagemagick
convert source.jpg -resize 640x480! -colors 14 xxx.xpm
gzip -9 xxx.rpms
hiddenmenu #隱藏grub引導菜單,除非用戶選擇顯示
title Red Hat Enterprise Linux (2.6.32-71.el6.i686)
root (hd0,0)
kernel /vmlinuz-2.6.32-71.el6.i686 ro root=UUID=0f4c5b88-8b5e-4cdb-8c7a-3f1ef4757703
rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us nomodeset crashkernel=auto rhgb quiet #內核文件路徑及傳遞給內核的參數
initrd /initramfs-2.6.32-71.el6.i686.img #假根
boot分區要是基本分區
(hd0,0) 在grub看來全部的硬盤都是hd,第一個0表示第一塊硬盤,第二個0表示第一個分區
在引導啓動時,若是grub沒有配置文件或配置文件已損壞,則須要如下修復步驟
find (hd#,0)/
root (hd0,0)
kernel /vmlinux-2.6.32-71.e16.i686 ro root=/dev/sda3
initrd /initramfs-2.6.32-71.el6.i686.img
boot
若是誤刪除grub,可使用下列命令進行命令行級別修復
grub-install --root-directory=/boot /dev/sda
從別的主機進行復制
scp 192.168.100.2:/boot/grub/grub
開機過程當中進入單用戶模式。setenforce 0 後可修改root密碼
給grub加密
grub-md5-crypt >> /boot/grub/grub.conf
將密碼粘貼至第一個titile前,全局生效 password --md5 PASSWD
kernel在整個啓動的過程當中,主要功能:
1.識別設備
2.加載驅動程序(極可能用到initrd)
3.以只讀方式掛載根文件系統
4.啓動/sbin/init進程
init
/etc/inittab
upstart
基於事件的觸發機制
systemd
ls /var/lock/subsys 鎖文件
# chkconfig: 345 95 5
# description: Runs commands scheduled by the "at" command at the time \
cp 123.sh /etc/init.d/123
chmod +x /etc/init.d/123
service 123 start
chkconfig - updates and queries runlevel information for system services
SYNOPSIS
chkconfig [--list] [--type type][name]
chkconfig --add name
chkconfig --del name
chkconfig --override name
chkconfig [--level levels] [--type type] name <on|off|reset|resetpriorities>
chkconfig [--level levels] [--type type] name
chkconfig --add
chkconfig --del
chkconfig --list
chkconfig --level name on|off
chkconfig name on|off
chkconfig: 345 95 5
345:服務須要開啓的運行級別,沒有被包含的運行級別就是關閉
95:若是將該服務設置爲連接,S開頭文件的編號
5:若是將該服務器設置爲連接,K開頭文件的編號
chkconfig --level 3 crond off