非常简便:

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. 10.十进制转m进制

    时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver 题解 查看运行结果 题目描述 Description 将十进制数n转换成m进制数 m<=16 n<=1 ...

  2. 内功心法 -- java.util.LinkedList<E> (7)

    写在前面的话:读书破万卷,编码如有神--------------------------------------------------------------------下文主要对java.util ...

  3. VK Cup 2016 - Qualification Round 2 D. Three-dimensional Turtle Super Computer 暴力

    D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Des ...

  4. 使用WCF测试客户端 z

    http://blog.csdn.net/u013036274/article/details/50570989 [是什么] WCF测试客户端(WCF Test Client)是一个用来测试WCF服务 ...

  5. Silverlight:《Pro Silverlight5》读书笔记 之 XAML

    XAML Properties and Events in XAML Simple Properties and Type Converters To bridge the gap between s ...

  6. Ubuntu OS应用Runtime Enviroment

    在这篇文章中.我们将介绍Ubuntu OS的Runtime Environment.在文章"App confinement: Security policy for click packag ...

  7. gradle 2.1构建android出现错误的解决方案

    转自:http://www.tuicool.com/articles/YJNJbuA 使用不同版本Gradle构建Andorid 出现Gradle version xxxx is required 坑 ...

  8. [Android Pro] android 禁用和开启四大组件的方法(setComponentEnabledSetting )

    在用到组件时,有时候我们可能暂时性的不使用组件,但又不想把组件kill掉,比如创建了一个broadcastReceiver广播监听器,用来想监听 第一次开机启动后获得系统的许多相关信息,并保存在文件中 ...

  9. Python操作dict时避免出现KeyError的几种方法

    见原文:https://www.polarxiong.com/archives/Python-%E6%93%8D%E4%BD%9Cdict%E6%97%B6%E9%81%BF%E5%85%8D%E5% ...

  10. ndk 编译 c++ 兼容性问题汇总整理

    转自:http://blog.csdn.net/wenrenwang/article/details/12003671 1.__int64找不到符号 采用int64_t来代替: #if defined ...