Ubuntu cronの設定

cronのインストール

1
apt-get install cron

cronの実行、状態確認、停止

1
2
3
service cron start
service cron status
service cron stop

cronの設定

1
2
cp /etc/crontab /etc/cron.d/cron
vi /etc/cron.d/cron

例えば以下のように追記します。

1
*/1 * * * *     root    echo "hello" >> /home/hoge/hello.txt

cronの再起動

service cron restart

確認

1分ごとに、hello.txtに追記されればOKです。

記事情報

  • 投稿日:2020年6月26日
  • 最終更新日:2020年6月26日