在这里写了很多篇linux,习惯了在这里写

centos中定时任务命令是crond

ubuntu中定时任务命令是cron

这两种linux系统不一样的地方还是挺多的,

既然我目前的专注点是ubuntu,所以centos就放下

-----

date -s 17:39:50 在centos中能对当前时间继续修改

但是在ubuntu中不行

-----

root@ubuntuE:/home/sophie# crontab -e

no crontab for root - using an empty one
Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/vim.gtk
  4. /usr/bin/vim.tiny
date +%y%m%d
-->160630
date +%Y%m%d
-->20160630

----------------

ubuntu  没有 centos中的 /var/log/crond

解决方法

http://askubuntu.com/questions/56683/where-is-the-cron-crontab-log

On a default installation the cron jobs get logged to

/var/log/syslog 

You can see just cron jobs in that logfile by running

 grep CRON /var/log/syslog 

If you haven't reconfigured anything,the entries will be in there.

-----or

You can create a cron.log file to contain just the CRON entries that show up in syslog. Note that CRON jobs will still show up in syslog if you follow the following directions.

Open the file

/etc/rsyslog.d/50-default.conf 

Find the line that starts with:

#cron.* 

uncomment that line, save the file, and restart rsyslog:

sudo service rsyslog restart 

You should now see a cron log file here:

/var/log/cron.log 

Cron activity will now be logged to this file (in addition to syslog).

Note that in cron.log you will see entries for when cron ran scripts in /etc/cron.hourly, cron.daily, etc. - e.g. something like:

Apr 12 14:17:01 cd CRON[14368]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly) 

However, you will not see more information about what scripts were actually ran inside /etc/cron.daily or /etc/cron.hourly, unless those scripts direct output to the cron.log (or perhaps to some other log file).

If you want to verify if a crontab is running and not have to search for it in cron.log or syslog, create a crontab that redirects output to a log file of your choice - something like:

01 14 * * * /home/joe/myscript >> /home/log/myscript.log 2>&1 

This will redirect all standard output and errors that may be produced by the script that is run to the log file specified.

ubuntu使用 服务的更多相关文章

  1. Ubuntu TFTP 服务

    /******************************************************************** * Ubuntu TFTP 服务 * 说明: * 在Ubun ...

  2. 解决Ubuntu MySQL服务无法远程登录

    一.10061错误 Ubuntu安装MySQL . sudo apt-get install mysql-server . apt-get isntall mysql-client . sudo ap ...

  3. Ubuntu ssh服务安装

    在使用xshell连接ubuntu虚拟机时,提示 Could not connect to '192.168.0.106' (port 22): Connection failed. 在主机使用pin ...

  4. Linux神器之Strace的实践(Ubuntu上服务幽灵般的消失)

    不论是运维,还是开发,面对Linux系统,时常会因为配置参数或者系统的权限(iptables限制端口,selinux拦截,文件目录权限等)原因出现程序或者服务异常,无法启动等等.特别是在Linux的文 ...

  5. 【Linux】Ubuntu配置服务自启动 sysv-rc-conf

    在Ubuntu下,配置服务系统开机自启动,使用的不是chkconfig,而是sysv-rc-conf. 且看如下: 安装: sudo apt-get install sysv-rc-conf 帮助信息 ...

  6. Ubuntu:系统启动服务

    系统启动服务 针对Ubuntu 5级别服务的说明 安装sysv-rc-conf sudo apt-get install sysv-rc-conf acpi-support 高级电源管理支持 acpi ...

  7. Ubuntu ssh 服务

    安装ssh-serversudo apt-get install openssh-server安装ssh-clientsudo apt-get install openssh-client 修改ssh ...

  8. Ubuntu Tftpd服务配置

    ---恢复内容开始--- 服务器端(ip:192.168.1.100) #安装tftpd-hpa sudo apt-get install tftpd-hpa 修改配置文件 sudo vim /etc ...

  9. Ubuntu自定义服务

    1.准备脚本 准备好一个bash服务脚本,包括start|stop|restart等参数,将脚本文件命名为“服务名”,拷贝到/etc/init.d/目录下. 2.添加服务sudo update-rc. ...

随机推荐

  1. 学习SQL的点点滴滴(五)-DELETE小计

    惨痛的教训: 某次在执行delete时,一时疏忽忘记写where条件了, 1.删除tb_mobile_cust_micromsg中的内容,前提是c_customer这个字段的值与#datamod表中c ...

  2. ruby中tes-unitt数据初始化方法整理

    在用ruby做测试时,很多时候需要一些数据初始化以及事后的数据恢复还原之类的操作,下面整理了这些方法.require "test/unit" class TestAnion < ...

  3. 微信开发-ACCESS TOKEN 过期失效解决方案

    微信开发-ACCESS TOKEN 过期失效解决方案 起因:因为access_token的重要性,开发过微信的都知道,但是他有自己的生命周期,官方解释为:"有效期为7200秒",一 ...

  4. MySQL concat函数的使用

    MySQL concat函数是MySQL数据库中众多的函数之一,下文将对MySQL concat函数的语法和使用进行说明,供您参考和学习. MySQL concat函数使用方法:CONCAT(str1 ...

  5. 3.2 一般的哈尔空间Vj

    例3.2给予我们继续往下面做的动力.很明显的我们对于g(t)的逼近还是太粗糙了.很自然的,我们会想到,如果继续细分我们的短点,比如每1/2取一个值,甚至每1/4取一个值,那么就会有更好的逼近效果. 不 ...

  6. ln命令小陷阱

    一个文件夹下面的文件结构是 -dir1 -assetsdir -subdir1 -subdir2 这个时候如果我想在subdir1和subdir2下面分别创建assetsdir的链接文件夹的话,应该怎 ...

  7. 批量改名工具 Bulk Rename Utility

    好用的批量改名工具 Bulk Rename Utility 功能: 这个工具既可以改文件名,也可以改目录. 使用技巧: 结合前缀4位 数字 可以让文件排列很整齐 例如:         0030 关于 ...

  8. C# 托管和非托管混合编程

    在非托管模块中实现你比较重要的算法,然后通过 CLR 的平台互操作,来使托管代码调用它,这样程序仍然能够正常工作,但对非托管的本地代码进行反编译,就很困难.   最直接的实现托管与非托管编程的方法就是 ...

  9. EF 分组查询

    var result = from m in userPrefers.GroupBy(t => new { t.Pet_Preferential.Merchant.MerchantId, t.P ...

  10. gtest学习一:在vs2013中搭建gtest环境

    gtest版本:1.7.0,在哪里下载源码就不说了,网上太多了~ 配置过程: 1.下载解压后,进入googletest/msvc目录,直接打开gtest.sln,发现有四个工程:gtest.gtest ...