かなり初歩。
時刻を引数に要求して、指定時刻の何等かを解析するスクリプトを一定間隔で実行したい。
ま、ヘマしてリカバーが必要になったなんかで、cron 登録するのはアレだし、日時跨いじゃうし、、、って時に。
interval.sh
#!/bin/bash
# date "+%s" -d"2016/12/08 12:00:00"
declare start=1481166000
for(( i=0 ; i <= 24 ; i++ )){
j=$(( $start - $i * 3600 ))
time=$(date "+%Y%m%d%H%M" -d@$j )
echo $time &
sleep 1
}
-
start
はエポック秒。 - 例は GNU coreutils の date