非常简便:

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. js冒泡处理

    <div id="first"> 外层 <span id="second"> 内层 </span> </div> ...

  2. Apache commons——Apache旗下的通用工具包项目

    Apache Commons是Apache旗下的一个开源项目,包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动 这里是Apache commons的官方网站 下面是工具的简单介绍: ...

  3. POJ 3384 Feng Shui (半平面交)

    Feng Shui Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3743   Accepted: 1150   Speci ...

  4. Simple dc/dc converter increases available power in dual-voltage system

    The schematic in Figure 1 shows a way to increase the power available from a current-limited 5V supp ...

  5. sql server datetime类型字段使用isnull返回1900-01-01 00:00:00.000的问题

    若字段定义的类型为datetime,插入为''(空),那么会默认值为1900-01-01 00:00:00.000 解决方法查询的时候过滤下cast(nullif('','') as datetime ...

  6. linux集成开发环境

    Linux操作系统的种种集成开发环境 随着Linux的逐渐兴起,已经有为数众多的程序在上面驰骋了,许多开发环境(Development Environment)也应运而生.好的开发环境一定是集成了编辑 ...

  7. matlab 图像常用函数

    Canny function [ canny ] = canny( rgb ) temp=rgb2gray(rgb); canny=edge(temp,'canny'); end 灰度 temp=rg ...

  8. 如何从MATLAB里面保存出分辨率高的图形

    MATLAB堪称科技工作者的倚天屠龙,其科学计算,简洁的编程风格,友好的图形界面等等,都使得它颇受欢迎.MATLAB作图相当简单,而且美观,但是,缺点是分辨率低,一直没有发现,直到最近一期刊编辑告诉我 ...

  9. 查看DNS主机名解析的主机IP并向DNSserver进行DNS域名解析

    一.查看DNS主机名解析的主机IP host 命令 用途 把一个主机名解析到一个网际地址或把一个网际地址解析到一个主机名. 语法 host [-n [ -a ] [ -c Class] [ -d ] ...

  10. 数学图形(2.7)sphere sine wave

    在球上以SIN曲线的轨迹游走. #http://www.mathcurve.com/courbes3d/couronnetangentoidale/couronnetangentoidale.shtm ...