安装crontab:

yum install crontabs

查看crontab服务状态:service crond status

手动启动crontab服务:service crond start

查看crontab服务是否已设置为开机启动,执行命令:chkconfig --list

如果没有加入开机启动:chkconfig crond on

添加一条定时任务:crontab -e进入编辑器

*/3 * * * * /usr/bin/curl http://127.0.0.1/charge/index.php/Admin/Cron/login

表示每3分钟执行一次这个路径,可以在login方法写日志看效果

可以查看下curl位置,find / -name 'curl'

重启crond服务

service crond restart

在终端直接运行下那个路径试一下看对不对

curl http://127.0.0.1/charge/index.php/Admin/Cron/login

这样就可以了,具体定时任务的其他用法参考网上

查看所有定时任务:crontab -l

删除所有定时任务:crontab -r

centos添加定时任务的更多相关文章

  1. CentOS添加新硬盘到新的分区(xfs/ext4) 或者添加新分区

    CentOs添加新硬盘到新的分区(xfs/ext4)  添加新分区 转载请注明:http://www.cnblogs.com/juandx/p/5618162.html 这篇文章介绍怎么添加一块新的硬 ...

  2. vm centos 添加网卡 无配置文件

    vm centos 添加网卡 无配置文件 解决办法 [root@test ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:C8:41:FB ...

  3. LINUX 添加定时任务

    LINUX 添加定时任务 crontab - l按 i:x 先按 esc然后 敲入 命令 :x*/5 3 * * 0 /root/ v.sh ..重启服务 service crond restart

  4. centos添加sudoers

    CentOS添加sudoers 1.chmod 740 /etc/sudoers 2. ## Allow root to run any commands anywhere     root    A ...

  5. Quartz动态添加定时任务执行sql(服务启动添加+手动添加)

    系统用来每天插入视图数据... 一.数据库表设计 1.接口配置表(t_m_db_interface_config) 2.接口日志表(t_m_db_interface_log) 3.前端配置页面 查询页 ...

  6. SpringBoot - 添加定时任务

    SpringBoot 添加定时任务 EXample1: import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.spri ...

  7. linux添加定时任务crond

    1.crontab –e:编辑当前定时任务 保存完重新crond : service crond restart 2. crontab用法 crontab –e : 修改 crontab 文件,如果文 ...

  8. centos添加额外测源,解决:No package openvpn available.

    centos添加额外测源,解决:No package openvpn available. ##添加额外的repositories,安装openvpn yum install epel-release ...

  9. CentOS添加环境变量的三种方式

    CentOS添加环境变量的三种方式,以添加php环境变量为例,假定php的安装目录为 /usr/local/php5 一.仅对当前会话临时生效 [root@bogon ~]# export PATH= ...

随机推荐

  1. sql 转 markdown

    https://github.com/2liang/AutoBuildDocFromDB SQL脚本生成数据字典 http://www.jianshu.com/p/f491d0d3c503 这两个脚本 ...

  2. xcode,不要将.a文件拖到xcode里

    如果将.a文件拖到xcode里,它自动生成的search path是错的.导致奇怪的编译错误,非常坑.这是xcode的一个bug. 或者为了省事直接将.a拖进xcode也行,但记着去Library S ...

  3. verilog语法注意部分

    l generate语句 Verilog-2001添加了generate循环,允许产生module和primitive的多个实例化,同时也可以产生多个variable,net,task,functio ...

  4. zendstdio的智能提示功能

    在项目的include的那个地方邮寄,在addsource file  然后指向TP类库的文件夹,刷新项目即可有智能提示

  5. MySQL:cannot allocate the memory for the buffer pool

    InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins Inno ...

  6. export,source

    source会把定义在脚本文件中的变量放在当前shell中 export会把变量放在他所在的shell进程以及子进程shell中 子shell进程可以访问父shell进程的export 声明的变量,但 ...

  7. Elasticsearch5.X IN Windows 10 系列文章(2)

    ElasticSearch版本: 5.5.1 (最新稳定版为5.5.2),由于用到IK中文分词插件,最新版本没有5.5.2 ,所以使用5.5.1 日期:2017-08-29 第二章:安装Kibana ...

  8. Java基础06 组合(转载)

    在一个新类的定义中使用其他对象.这就是组合(composition).组合是在Java中实现程序复用(reusibility)的基本手段之一.   组合与"has-a" 一个对象是 ...

  9. Spring MVC Hibernate验证器

    下面的示例演示如何使用Spring Web MVC框架在表单中使用错误处理和验证器. 首先使用Eclipse IDE,并按照以下步骤使用Spring Web Framework开发基于动态表单的Web ...

  10. git Staging Deleted files

    Use git rm foo to stage the file for deletion. (This will also delete the file from the file system, ...