crontab

crontab 命令使用

匿名 (未验证) 提交于 2019-12-03 00:34:01
什么是crontab? 怎么使用? ? Downloads rpm -qa | grep cron crontabs-1.11-16.20150630git.fc28.noarch cronie-1.5.1-9.fc28.x86_64 cronie-anacron-1.5.1-9.fc28.x86_64  2. 服务启动和关闭 使用 systemctl 管理 ? Downloads systemctl restart crond.service 3. 配置文件 ? ~ ls -l /etc/cron* -rw-r--r--. 1 root root 0 Feb 7 13:58 /etc/cron.deny -rw-r--r--. 1 root root 451 Feb 7 13:57 /etc/crontab /etc/cron.d: total 8 -rw-r--r--. 1 root root 128 Feb 7 13:58 0hourly -rw-r--r--. 1 root root 108 Aug 4 2017 raid-check /etc/cron.daily: total 24 -rwxr-xr-x. 1 root root 18812 Apr 26 10:21 google-chrome -rwxr-xr-x. 1 root root 189 Jan 4 19

第十五次课

匿名 (未验证) 提交于 2019-12-03 00:27:02
保存和备份iptables规则 service iptables save //会把规则保存到/etc/sysconfig/iptables [root @linux7 - 128 ~] # service iptables save iptables: Saving firewall rules to /etc/sysconfig/ iptables: [ 确定 ] 把iptables规则备份到my.ipt文件中 iptables-save > my.ipt [root@linux7-128 ~]# iptables-save > /tmp/my.txt [root@linux7-128 ~]# cat /tmp/my.txt # Generated by iptables-save v1.4.21 on Tue Jun 12 19:16:51 2018 *mangle :PREROUTING ACCEPT [277:25577] :INPUT ACCEPT [277:25577] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [239:28886] :POSTROUTING ACCEPT [248:30809] - A POSTROUTING -o virbr 0 -p udp -m udp --dport 68 -j CHECKSUM -

crontab arm

匿名 (未验证) 提交于 2019-12-03 00:27:02
crontab 所以首先创建这样一个目录吧! mkdir -p /var/spool/cron/crontabs 然后编辑要执行的任务 crontabs -e crontab 是用来让使用者在固定时间或固定间隔执行程序之用,换句话说,也就是类似使用者的时程表。 按照网上查找的资料执行时经常会碰到这种错误: crontab: chdir(/var/spool/cron/crontabs): No such file or directory 所以首先创建这样一个目录吧! mkdir -p /var/spool/cron/crontabs 然后编辑要执行的任务 crontabs -e 0 /1 * * /sbin/ntpdate 192.168.1.67 >/dev/null 2>&1 每隔一个小时更新下时间,不打印任何信息 最后,执行下 crond 此时你会发现/var/spool/cron/crontabs下有一个跟用户名相同的文件,保存着要执行的任务。 ps下会发现cron进程已经启动! # * * * * * user-name command to be executed crontab -l crond 当crontab失效时,可以尝试以下语句,以便解决问题 root@kali:~# /etc/init.d/cron restart root@kali:~# service

Crontab Day of the Week syntax

不打扰是莪最后的温柔 提交于 2019-12-03 00:26:45
问题 In crontab does the Day of the Week field run from 0 - 6 or 1 -7 ? I am seeing conflicting information on this. wikipedia states 0-6 and other sites I have seen are 1-7 . Also what would be the implication or either using 0 or 7 incorrectly? i.e. would the cron still run? 回答1: 0 and 7 both stand for Sunday, you can use the one you want, so writing 0-6 or 1-7 has the same result. Also, as suggested by @Henrik, it is possible to replace numbers by shortened name of days, such as MON , THU , etc

挖矿病毒排查

匿名 (未验证) 提交于 2019-12-03 00:25:02
四、挖矿恶意程序处理流程 4.1 异常问题定位 4.1.1 异常进程排查 (1)top 排查 使用top命令直接动态排查可能异常进程,配合 -c可以直接查找到异常进程的物理位置。 1. # top -c (2)ps -ef 排查 # ps -ef |grep wnTKYg ps -ef |grep ddg.2021 (3) 疑似进程定位 [root@localhost ~]# find / -name wnTKYg* /tmp/wnTKYg [root@localhost ~]# 4.1.2 异常会话排查 (1) # netstat -pantul |grep ESTAB 查询会话建立情况,查看是否有异常会话连接。 1. [root@MiWiFi-R3-srv tmp]# netstat -pantul |grep ESTAB 2. tcp 0 0 192.168.31.9:22 192.168.31.75:3898 ESTABLISHED 3742/sshd 3. tcp 0 0 192.168.31.9:56842 163.172.226.120:443 ESTABLISHED 7263/wnTKYg 4. tcp 0 0 192.168.31.9:22 192.168.31.75:3953 ESTABLISHED 3795/sshd 5. tcp 0 0 192.168.31

centos 定时执行脚本

匿名 (未验证) 提交于 2019-12-03 00:03:02
1.安装crontab #yum install crontabs 2.编辑定时任务: #crontab -e 3.路径要写绝对路径 * * * * * python /home/xxx.py ###每分钟执行一次 #5 * * * * python /home/xxx.py ###每小时05分时执行一次 4.重启服务 #service crond restart 来源:51CTO 作者: 小帆97 链接:https://blog.csdn.net/weixin_41396062/article/details/100802159

crontab

匿名 (未验证) 提交于 2019-12-03 00:03:02
Crontab命令使用 crontab 是用来让使用者(用户)在固定时间或固定间隔(即既定时间设置内)执行应用程序或代码。 crontab file [-u user] -用指定的文件替代目前的crontab. crontab -[-u user] -用标准输入替代目前的crontab. crontab -1[user] -列出用户目前的crontab. crontab -e[user] -编辑用户目前的crontab. crontab -d[user] -删除用户目前的crontab. **crontab -c dir ** -指定crontab的目录。 命令示例: 查看当前用户的定时任务 编辑当前用户的定时任务 编辑当前用户的定时任务 Crontab命令时间格式设置 *  *  *  *  *   command 分  时  日  月  周  命令 第1列表示分钟1~59 每分钟用*或者 */1表示 第2列表示小时1~23(0表示0点) 第3列表示日期1~31 第4列表示月份1~12 第5列标识号星期0~6(0表示星期天) 第6列要运行的命令 Crontab命令 Crontab定时任务示例 30 21 * * * /usr/local/etc/rc.d/lighttpd restart 上面的例子表示每晚的21:30重启apache。 45 4 1,10,22 * * /usr

django-crontab执行定时任务

匿名 (未验证) 提交于 2019-12-02 23:57:01
摘自: http://www.aiuxian.com/article/p-3187478.html django-crontab实现定时任务 1 django-crontab安装 django-crontab安装: pip install django - crontab django-crontab加入:只需要将 django - crontab 加入到settings.py的 INSTALLED_APPS 即可。如下代码: INSTALLED_APPS = ( 'django_crontab', ... ) 2 django-crontab配置 django-crontab可以定时运行自定义命令和函数两种方式,因为之前尝试用command+crontab时已经实现了自定义command,所以自然而然使用了自定义命令这种形式。 2.1 django-crontab定时运行命令 我先参考 Django官方文档 自定义了一个命令 aizhan_5domain_visits ,专门用于抓取爱站流量,并将结果保存在sqlite3数据库中(具体步骤在本文中不赘述了)。 其次,我在 settings . py 中加入了django-crontab的命令: CRONJOBS = [ ('47 11 * * *', 'django.core.management.call_command', [

crontab使用方法

匿名 (未验证) 提交于 2019-12-02 23:57:01
cron是一个linux下 的定时执行工具,可以在无需人工干预的情况下运行作业。 service crond start //启动服务 service crond stop //关闭服务 service crond restart //重启服务 service crond reload //重新载入配置 service crond status //查看服务状态 /var/spool/cron/crontabs #这个目录下存放的是每个用户包括root的crontab任务,每个任务以创建者的名字命名。 crontab (选项) (参数) -e:编辑该用户的计时器设置; -l:列出该用户的计时器设置; -r:删除该用户的计时器设置; -u<用户名称>:指定要设定计时器的用户名称。 crontab文件:指定包含待执行任务的crontab文件。可以不指定,默认是/var/spool/cron/crontabs/下名字为当前用户名的文件。 # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | |

Shell脚本定时监控

匿名 (未验证) 提交于 2019-12-02 23:47:01
1.建立脚本文件 autostart.sh #!/bin/bash ps -ef|grep tomcat |grep -v grep if [ $? -ne 0 ] then echo "start tomcat......" /home/tomcat/apache-tomcat-8.0.44/bin/startup.sh else echo "tomcat runing......" fi 保存脚本,手动运行一下,确保没有错误。 2.执行crontab -e,来进入定时设置: */1 * * * * /home/tomcat/autostart.sh 3.设置好后重启crontab服务,命令如下: service crond restart 设置完成! 4.查看邮件了解脚本定时执行的情况: mail