保存crontab文件 [英] Saving Crontab files

查看:178
本文介绍了保存crontab文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关crontab的一个简单的问题,不是身在何处,我保存的crontab文件? (使用crontab -e命令创建与时间相关的作业)或他们可以从任何目录中读取?

A simple question about Crontab, does it matter where I save crontab files? (creating the time-dependent jobs using crontab -e) or can they be read from any directory?

我问,因为它似乎是我的crontab文件删除了,因为当我用crontab的-l它没有返回任何东西。不过,我认为这是因为我救它作为一个临时文件:创造更持久的crontab文件

I ask because it seemed that my crontab file got deleted because when I used the crontab -l it didn't return anything. However, I think that is because I saved it as a temporary file: Creating more permanent crontab files

推荐答案

通常情况下,你可以使用的crontab 以创建该文件,它存储在正确的地方你机器。

Normally, you use crontab to create the file, and it stores it in the correct place for your machine.

$ crontab < $HOME/etc/crontab

然后使用的crontab -l <​​/ code>来列出它。

Then you use crontab -l to list it.

$ crontab -l
#   @(#)$Id: crontab,v 4.2 2007/09/17 02:41:00 jleffler Exp $
#   Crontab file for Home Directory for Jonathan Leffler (JL)
#-----------------------------------------------------------------------------
#Min     Hour    Day     Month   Weekday Command
#-----------------------------------------------------------------------------
0        *       *       *       *       /usr/bin/ksh /work4/jleffler/bin/Cron/hourly
1        1       *       *       *       /usr/bin/ksh /work4/jleffler/bin/Cron/daily
23       1       *       *       1-5     /usr/bin/ksh /work4/jleffler/bin/Cron/weekday
2        3       *       *       0       /usr/bin/ksh /work4/jleffler/bin/Cron/weekly
21       3       1       *       *       /usr/bin/ksh /work4/jleffler/bin/Cron/monthly
$

在哪里我把我原来并不重要(但它是在 $ HOME /等,因为它发生源控制之下)。该系统具有自己的地方需要它的文件副本。

Where I keep my original is immaterial (but it is under source control in $HOME/etc as it happens). The system has its own copy of the file where it needs it.

如果您尝试手动放置这些文件,你会被咬伤。也许工作,但话又说回来,它可能不是(它可能在未来改变)。我不会被播放使用非犹太命令其他存储使用crontab文件的冒险游戏的crontab

If you try placing the files manually, you will get bitten. It might work, but then again, it might not (and it might change in the future). I wouldn't play the risky game of using other than the kosher command to store crontab files for use by crontab.

这篇关于保存crontab文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆