[toc]html
擴展(未完成)node
anacron http://blog.csdn.net/strikers1982/article/details/4787226linux
xinetd服(默認機器沒有安裝這個服務,須要yum install xinetd安裝) http://blog.sina.com.cn/s/blog_465bbe6b010000vi.htmlshell
systemd自定義啓動腳本 http://www.jb51.net/article/100457.htmvim
[root@localhost ~]# cat /etc/crontab 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
[root@localhost ~]# crontab -e no crontab for root - using an empty one crontab: installing new crontab
[root@localhost ~]# systemctl start crond [root@localhost ~]# ps aux |grep cron root 903 0.0 0.0 126264 1636 ? Ss 15:16 0:00 /usr/sbin/crond -n root 6761 0.0 0.0 112676 976 pts/0 S+ 20:23 0:00 grep --color=auto cron
[root@localhost ~]# systemctl status crond ● crond.service - Command Scheduler Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled) Active: active (running) since 一 2018-02-26 10:27:29 CST; 9h ago Main PID: 903 (crond) CGroup: /system.slice/crond.service └─903 /usr/sbin/crond -n
查看crontab -e中是否爲寫明命令的絕對路徑,而是直接寫了command, 同時把正確和錯誤的執行過程記錄在日誌文件中,==方便後續查找??是否說的這個==bash
[root@localhost ~]# crontab -l 0 3 * * * /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log
[root@localhost ~]# crontab -r [root@localhost ~]# crontab -l no crontab for root
[root@localhost ~]# crontab -u root -l no crontab for root
[root@localhost ~]# chkconfig --list 注意:該輸出結果只顯示 SysV 服務,並不包含原生 systemd 服務。SysV 配置數據可能被原生 systemd 配置覆蓋。 若是您想列出 systemd 服務,請執行 'systemctl list-unit-files'。 欲查看對特定 target 啓用的服務請執行 'systemctl list-dependencies [target]'。 netconsole 0:關 1:關 2:關 3:關 4:關 5:關 6:關 network 0:關 1:關 2:開 3:開 4:開 5:開 6:關
早期的CentOS6用到的服務管理都是SysV,而7換成了systemd. 輸入top,查看: app
[root@localhost ~]# ls /etc/init.d/ functions netconsole network README
[root@localhost ~]# chkconfig --level 3 network off [root@localhost ~]# chkconfig --list |grep network
[root@localhost ~]# chkconfig --level 345 network off
[root@localhost ~]# cd /etc/init.d/ [root@localhost init.d]# ls functions netconsole network README
增長名稱爲123的服務ssh
[root@localhost init.d]# cp network 123 [root@localhost init.d]# ls -l 總用量 40 -rwxr-xr-x 1 root root 6643 2月 26 21:05 123 -rw-r--r--. 1 root root 15131 9月 12 2016 functions -rwxr-xr-x. 1 root root 2989 9月 12 2016 netconsole -rwxr-xr-x. 1 root root 6643 9月 12 2016 network -rw-r--r--. 1 root root 1160 5月 26 2017 README
[root@localhost init.d]# chkconfig --del 123 [root@localhost init.d]# chkconfig --list 注意:該輸出結果只顯示 SysV 服務,並不包含原生 systemd 服務。SysV 配置數據可能被原生 systemd 配置覆蓋。 若是您想列出 systemd 服務,請執行 'systemctl list-unit-files'。 欲查看對特定 target 啓用的服務請執行 'systemctl list-dependencies [target]'。 netconsole 0:關 1:關 2:關 3:關 4:關 5:關 6:關 network 0:關 1:關 2:開 3:關 4:關 5:關 6:關
[root@localhost init.d]# systemctl list-units --all --type=service UNIT LOAD ACTIVE SUB DESCRIPTION abrt-ccpp.service loaded active exited Install ABRT coredump hook abrt-oops.service loaded active running ABRT kernel log watcher abrt-vmcore.service loaded inactive dead Harvest vmcores for ABRT abrt-xorg.service loaded active running ABRT Xorg log watcher abrtd.service loaded active running ABRT Automated Bug Reporting Tool accounts-daemon.service loaded inactive dead Accounts Service alsa-restore.service loaded inactive dead Save/Restore Sound Card State alsa-state.service loaded active running Manage Sound Card State (restore and store) ● apparmor.service not-found inactive dead apparmor.service atd.service loaded active running Job spooling tools auditd.service loaded active running Security Auditing Service auth-rpcgss-module.service loaded inactive dead Kernel Module supporting RPCSEC_GSS avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
[root@localhost ~]# systemctl enable crond.service [root@localhost ~]# systemctl disable crond Removed symlink /etc/systemd/system/multi-user.target.wants/crond.service.
[root@localhost ~]# ls /usr/lib/systemd/system abrt-ccpp.service irqbalance.service runlevel3.target abrtd.service iscsid.service runlevel3.target.wants abrt-oops.service iscsid.socket runlevel4.target abrt-pstoreoops.service iscsi.service runlevel4.target.wants abrt-vmcore.service iscsi-shutdown.service runlevel5.target abrt-xorg.service iscsiuio.service runlevel5.target.wants accounts-daemon.service iscsiuio.socket runlevel6.target alsa-restore.service kdump.service saslauthd.service alsa-state.service kexec.target selinux-policy-migrate-local-changes@.service alsa-store.service kexec.target.wants serial-getty@.service anaconda-direct.service kmod-static-nodes.service shutdown.target anaconda-nm-config.service kpatch.service shutdown.target.wants anaconda-noshell.service ksm.service sigpwr.target anaconda-pre.service ksmtuned.service sleep.target anaconda.service libstoragemgmt.service -.slice anaconda-shell@.service libvirtd.service slices.target anaconda-sshd.service libvirt-guests.service smartcard.target anaconda.target lldpad.service smartd.service anaconda-tmux@.service lldpad.socket sockets.target arp-ethers.service local-fs-pre.target sockets.target.wants
[root@localhost system]# systemctl is-active crond.service active
[root@localhost ~]# systemctl list-unit-files --type=target UNIT FILE STATE anaconda.target static basic.target static bluetooth.target static cryptsetup-pre.target static cryptsetup.target static ctrl-alt-del.target disabled default.target enabled emergency.target static final.target static getty.target static graphical.target static halt.target disabled hibernate.target static hybrid-sleep.target static initrd-fs.target static initrd-root-fs.target static initrd-switch-root.target static initrd.target static iprutils.target disabled kexec.target disabled local-fs-pre.target static local-fs.target static machines.target disabled multi-user.target enabled
[root@localhost ~]# systemctl list-dependencies multi-user.target multi-user.target ● ├─abrt-ccpp.service ● ├─abrt-oops.service ● ├─abrt-vmcore.service ● ├─abrt-xorg.service ● ├─abrtd.service ● ├─atd.service ● ├─auditd.service ● ├─avahi-daemon.service ● ├─brandbot.path ● ├─chronyd.service ● ├─crond.service ● ├─cups.path ● ├─cups.service ● ├─dbus.service ● ├─irqbalance.service ● ├─kdump.service ● ├─ksm.service ● ├─ksmtuned.service ● ├─libstoragemgmt.service ● ├─libvirtd.service ● ├─mdmonitor.service ● ├─ModemManager.service ● ├─netcf-transaction.service ● ├─network.service
[root@localhost ~]# systemctl list-dependencies basic.target basic.target ● ├─alsa-restore.service ● ├─alsa-state.service ● ├─iptables.service ● ├─microcode.service ● ├─rhel-autorelabel-mark.service ● ├─rhel-autorelabel.service ● ├─rhel-configure.service ● ├─rhel-dmesg.service ● ├─rhel-loadmodules.service ● ├─selinux-policy-migrate-local-changes@targeted.service ● ├─paths.target ● ├─slices.target ● │ ├─-.slice ● │ └─system.slice ● ├─sockets.target ● │ ├─avahi-daemon.socket ● │ ├─cups.socket ● │ ├─dbus.socket ● │ ├─dm-event.socket ● │ ├─iscsid.socket ● │ ├─iscsiuio.socket ● │ ├─rpcbind.socket ● │ ├─systemd-initctl.socket ● │ ├─systemd-journald.socket
[root@localhost ~]# systemctl get-default multi-user.target
[root@localhost ~]# systemctl set-default multi-user.target Removed symlink /etc/systemd/system/default.target. Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.socket
cat /usr/lib/systemd/system/sshd.service //看[install]部分 工具