ubuntu 设置计划任务
非常简便:
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 设置计划任务的更多相关文章
- 转载--Ubuntu设置环境变量
Ubuntu设置环境变量并立即生效(以Ubuntu12.04为例) 标签: UbuntuLinux环境变量 2013-09-12 19:04 9961人阅读 评论(1) 收藏 举报 分类: Ubun ...
- Ubuntu 设置root用户登录
由于 Ubuntu 是基于 Debian 的 linux 操作系统,在默认的情况下,是没有超级用户(superuser, root)的,但有些系统操作必须有超级用户的权限才能进行,如手动释放内存等. ...
- Ubuntu设置中文
Ubuntu设置中文:需要联网下载中文包,不然无法设置中文系统. 进去系统后再右上角有个齿轮图标点击,找到系统设置(System Settings)点击弹出一个界面,找到Language Suppor ...
- ubuntu设置系统时间与网络时间同步
ubuntu设置系统时间与网络时间同步 Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC). 系统时间:指当前Linux Ker ...
- Ubuntu设置程序开机自启或者开机禁止加载
先说说ubuntu,它有运行级别这个概念 0:停机 1:单用户形式,只root进行维护 2:多用户,不能使用net file system 3:完全多用户 5:图形化 6:重启 例子:按指定顺序.在指 ...
- Linux - ubuntu 设置固定ip和设置dns
ubuntu 设置固定ip和设置dns 1.ifconfig 查看网卡名称 root@jiqing-virtual-machine:~# ifconfig ens32 Link encap:以太网 硬 ...
- 【命令】Ubuntu设置和查看环境变量
转自[Ubuntu]Ubuntu设置和查看环境变量 查看环境变量 env env命令是environment的缩写,用于列出所有的环境变量 export 单独使用export命令也可以像env列出所有 ...
- linux下设置计划任务执行python脚本
linux下设置计划任务执行python脚本 简介 crontab命令被用来提交和管理用户的需要周期性执行的任务,与windows下的计划任务类似,当安装完成操作系统后,默认会安装此服务工具,并且会自 ...
- ubuntu设置开机默认进入字符界面方法 ubuntu 12.04 桌面版关闭图形界面(转)
ubuntu 12.04 桌面版关闭图形界面 注意]改GRUB 的配置文件(不建议直接改 grub.conf) file:/etc/default/grub GRUB_CMDLINE_LINUX_DE ...
随机推荐
- 判断一个js对象是不是数组
//今天突然想到一个问题,如何判断一个对象是不是数组 var arr = [0, 1, 2]; console.log(arr) //object, 显然不行 //查阅了很多资料,发现几个挺不错的方法 ...
- HDU 5642 King's Order 动态规划
King's Order 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5642 Description After the king's speec ...
- sybase数据库技术 :游标可更新与for read only/for update
在定义游标时不指定for update 或 for read only,ASE会检查以了解游标是否可更新: 如果游标查询语句中包含order by子句,则ASE会将游标定义为只读:其它情况下定义为可更 ...
- 线性稳压器 (LDO)
线性稳压器 (LDO) 当输出电压低于输入电压时,必须从负载电源和压降比来考虑要采用线性稳压器 (LDO) 或降压转换器 (Buck) 低压降线性稳压器 (LDO) 适合用在需求低噪讯.低电流和低压降 ...
- miniSpartan6, another Spartan 6 Kit
http://thehardwarer.com/2013/05/minispartan-6-another-spartan-6-kit/ miniSpartan6 is an Opens Source ...
- PEM DAC note
开发指南V1.0库函数版本,PWM DAC实验 350页 STM32 的定时器最快的计数频率是72Mhz,8 为分辨率的时候,PWM 频率为72M/256=281.25Khz.如果是1阶RC滤波,则要 ...
- 字符串型MySQL查询条件需要注意的一点
最近在工作中遇到了数据库服务器产生很多读写队列的问题,于是要求大家开始优化我们的SQL语句. 下面是查询quotedata_history表中的code字段的SQL语句,其中code字段的类型是var ...
- 使用tortoisegit访问git@oschina
转自:http://www.3lian.com/edu/2014/01-03/121350.html 首先,如果你想使用git@oschina ,你的电脑上必须先有git工具:你可以从这里获取谷歌提供 ...
- [翻译] AnimatedTransitionGallery
AnimatedTransitionGallery 转场动画回廊 https://github.com/shu223/AnimatedTransitionGallery Collection of i ...
- whois协议
1.原理非常简单,域名的查询主要是基于RFC 954提供的WHOIS协议.在上述过程中,我们实际上是访问了InterNIC站点的WHOIS服务器,该服务器从WHOIS数据库中查询我们所需要的内容.WH ...