非常简便:

crontab -e

以下是我的执行过程,输入命令后,会让我选择一个编辑器,我选的是2,因为后边写着easiest,最简单的。

liuyx@myubuntu:/$ crontab -e
no crontab for liuyx - using an empty one Select an editor. To change later, run 'select-editor'.
. /bin/ed
. /bin/nano <---- easiest
. /usr/bin/vim.tiny

Choose - []:
crontab: installing new crontab

选2之后会进入一个文本编辑状态,在里面根据提示,配置你要执行的任务即可:

例如我的配置:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at a.m every week with:
# * * tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab() and cron()
#
# m h dom mon dow command
* * * * * java -jar /home/liuyx/refreshIp/refreshIp.jar

只有最后一行是我写的,我的任务的意思是 每分钟执行一下这个jar包。五个*代表时间规则,后边的就是要执行的命令。命令这个不用说,要执行什么就写什么。时间规则是遵循cron表达式,具体请参阅cron表达式的相关写法。

配置完这些之后,记得执行一下:

sudo service cron restart

来让你的配置生效。

完毕。

也可以参阅这个:https://help.ubuntu.com/community/CronHowto

ubuntu 设置计划任务的更多相关文章

  1. 转载--Ubuntu设置环境变量

    Ubuntu设置环境变量并立即生效(以Ubuntu12.04为例) 标签: UbuntuLinux环境变量 2013-09-12 19:04 9961人阅读 评论(1) 收藏 举报  分类: Ubun ...

  2. Ubuntu 设置root用户登录

    由于 Ubuntu 是基于 Debian 的 linux 操作系统,在默认的情况下,是没有超级用户(superuser, root)的,但有些系统操作必须有超级用户的权限才能进行,如手动释放内存等.  ...

  3. Ubuntu设置中文

    Ubuntu设置中文:需要联网下载中文包,不然无法设置中文系统. 进去系统后再右上角有个齿轮图标点击,找到系统设置(System Settings)点击弹出一个界面,找到Language Suppor ...

  4. ubuntu设置系统时间与网络时间同步

    ubuntu设置系统时间与网络时间同步   Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC).   系统时间:指当前Linux Ker ...

  5. Ubuntu设置程序开机自启或者开机禁止加载

    先说说ubuntu,它有运行级别这个概念 0:停机 1:单用户形式,只root进行维护 2:多用户,不能使用net file system 3:完全多用户 5:图形化 6:重启 例子:按指定顺序.在指 ...

  6. Linux - ubuntu 设置固定ip和设置dns

    ubuntu 设置固定ip和设置dns 1.ifconfig 查看网卡名称 root@jiqing-virtual-machine:~# ifconfig ens32 Link encap:以太网 硬 ...

  7. 【命令】Ubuntu设置和查看环境变量

    转自[Ubuntu]Ubuntu设置和查看环境变量 查看环境变量 env env命令是environment的缩写,用于列出所有的环境变量 export 单独使用export命令也可以像env列出所有 ...

  8. linux下设置计划任务执行python脚本

    linux下设置计划任务执行python脚本 简介 crontab命令被用来提交和管理用户的需要周期性执行的任务,与windows下的计划任务类似,当安装完成操作系统后,默认会安装此服务工具,并且会自 ...

  9. ubuntu设置开机默认进入字符界面方法 ubuntu 12.04 桌面版关闭图形界面(转)

    ubuntu 12.04 桌面版关闭图形界面 注意]改GRUB 的配置文件(不建议直接改 grub.conf) file:/etc/default/grub GRUB_CMDLINE_LINUX_DE ...

随机推荐

  1. hdu 3435 图回路分割

    将一个无向图分成许多回路,回路点交集为空,点幷集为V.幷最小化回路边权和. #include <cstdio> #include <cstring> #include < ...

  2. ThinkPHP -- magic_quotes_gpc()引起的反斜杠问题

    magic_quotes_gpc()引起的反斜杠问题,通常是因为没有事先判断它的状态,而对字符串进行处理引起的.   (本文学习借鉴于hechunhua楼主) 一般提供的服务器空间默认PHP 指令 m ...

  3. Markdown 简明语法手册 - 作业

    目录 Cmd Markdown 简明语法手册 1. 内容目录 2. 标签分类 3. 删除线 水平线--- 1. 斜体和粗体 2. 分级标题 标题1 标题2 标题3 3. 外链接 4. 无序列表 5. ...

  4. POJ 1755 Triathlon (半平面交)

    Triathlon Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4733   Accepted: 1166 Descrip ...

  5. DTCC:MySQl核心代码开发经验揭示

    http://tech.it168.com/a2012/0413/1337/000001337236.shtml

  6. JavaScript面试(-------------------------------------------)

    this是什么 方法调用模式 构造器调用模式 函数调用模式 apply/call模式 this是什么 —大多语言中,’this’代表由类实例化的当前对象.在JavaScript中,’this’通常表示 ...

  7. JSON数据转换成table表格

    <%@ page contentType="text/html; charset=UTF-8" %> <%@taglib uri="/struts-ta ...

  8. Python性能优化:PyPy、Numba 与 Cython。PyPy的安装及对应pip的安装

    性能优化讨论见参考1:大概意思是,PyPy内置JIT,对纯Python项目兼容性极好,几乎可以直接运行并直接获得性能提升:缺点是对很多C语言库支持性不好.Numba是一个库,可以在运行时将Python ...

  9. trident介绍

    (一)理论基础 很多其它理论以后再补充,或者參考书籍 1.trident是什么? Trident is a high-level abstraction for doing realtime comp ...

  10. Python 爬虫(2)多线程

    前面说过由于GIL的存在,Python的多线程效率没有希望的那么高,python的多线程适合IO密集型的情况,而爬虫恰好就是一个IO密集的情况,因为爬虫中很大一部分时间,是在等待socket返回数据. ...