0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

一般ユーザで anacron を使って、毎日実行する JOB を作成

Last updated at Posted at 2019-05-19

Debian 10で動作確認をしています。

まず、ディレクトリを作ります。

$ midir .anacron
$ mkdir .anacron/spool
$ mkdir .anacron/cron.daily

.anacron/anacrontab を作成します。次のような内容にします。

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RANDOM_DELAY=5
MAILTO=user1
HOME=/home/user1

1 5 cron.daily nice run-parts ${HOME}/.anacron/cron.daily

crontab -eを実行して、次の行を追加します。

*/10 * * * * /usr/sbin/anacron -t ${HOME}/.anacron/anacrontab -S ${HOME}/.anacron/spool

anacron/cron.daily にスクリプトを置くと、毎日、1回実行されます。

ファイルのバックアップに使えます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?