명령

/lib/systemd/system/yona-report-crawler.service
/lib/systemd/system/yona-report-crawler.timer
$ systemctl enable yona-report-crawler.timer # 부팅시 실행
$ systemctl start yona-report-crawler.timer
$ systemctl daemon-reload
$ systemctl list-timers
$ systemctl list-units | grep "yona"

timer 파일

[Unit]
Description=Yona Report Crawler

[Timer]
OnCalendar=*-*-* 22:00:00
Persistent=True
Unit=yona-report-crawler.service

[Install]
WantedBy=default.target
  • OnCalendar
    • [요일] 년-월-일 시:분:초 [timezone]
    • 요일 표기
      • Monday: Mon
      • Thursday: Thu
    • 요일, timezone 생략가능
    • minutely, hourly, daily, monthly, weekly, yearly, quarterly, semiannually 사용가능
  • OnActiveSec, OnBootSec, OnStartupSec

service 파일

[Unit]
Description=yona-report-crawler
Documentation=None
After=network.target

[Service]
SyslogIdentifier=yona-report-crawler
Environment=
Type=simple
User=root
WorkingDirectory=/app/yona-report-crawler
ExecStart=/app/yona-report-crawler/run
Restart=on-failure

[Install]
WantedBy=multi-user.target

참고자료