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?

【Bash】一分ごとにタイムスタンプを取る

Posted at
# 実行するファイル作成
touch job.sh
# タイムスタンプを書き込むファイル作成
touch job.log
# ファイルを開く
vi job.sh
job.sh
1 #!/bin/bash
2
3 timestamp=$(date +"%Y%m%d_%H%M%S")
4 echo "$timestamp" >> job.log

:set number もしくは :set nuで行番号表示できる
:set nonumberで非表示

# 自動化で使う設定ファイルを編集
crontab -e

# 中身
# 分 時 日 月 曜日 実行するコマンド
 */1 * * * * /home/shuta/job.sh

# */1 何分おき
# 1   毎時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?