Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRON잡 생성을 위한 bash 스크립트 작성 #77

Merged
merged 3 commits into from
Dec 1, 2023
Merged

Conversation

keonly
Copy link
Contributor

@keonly keonly commented Nov 29, 2023

./install.sh

스크립트 기능

초기 셋업을 위한 쉘 스크립트입니다.

  • Python 가상 환경 newways를 생성하고 활성화
  • ~/API-scrap-and-analysis/requirements.txt에 명시된 필요한 패키지들을 설치
  • Chromedriver를 다운로드하고, 압축을 풀고, 실행 가능한 파일을 시스템 경로에 설치

Prerequisites

  • 시스템에 Python 3.10이 설치되어 있어야 함
  • 가상 환경을 생성하기 위해 virtualenv가 필요
  • Chromedriver를 /usr/local/bin/에 설치하기 위해 sudo 권한 필요

Usage

  • cd ~ && git clone https://github.com/NewWays-TechForImpactKAIST/API-scrap-and-analysis.git
  • cd ~/API-scrap-and-analysis && chmod +x ./install.sh
  • ./install.sh

./run_scrap_scripts.sh

스크립트 기능

CRON잡을 위해 실행할 스크립트입니다. 지방의회 및 광역의회에 대한 크롤링을 진행하고 MongoDB에 저장합니다.

Prerequisites

  • API-scrap-and-analysis 레포 디렉토리가 ~에 있는 것을 가정하고 있습니다.
  • (./install.sh를 이용하여) newways라는 virtal env를 생성하고, requirements.txt의 패키지를 설치
  • Chromedriver 설치

Usage

  • cd ~/API-scrap-and-analysis && chmod +x ./run_scrap_scripts.sh
  • ./run_scrap_scripts.sh

CRON잡 추가 (ft. ChatGPT)

To set up a CRON job to run this script once a week, you need to edit the crontab file:

  • Run crontab -e to edit the crontab for your user.
  • Add the following line to run the script every week at a specific time (e.g., 3 AM on Sundays):
0 3 * * 0 ~/API-scrap-and-analysis/run_scrap_scripts.sh
  • 0 3 means 3:00 AM.
  • The first * means every day of the month.
  • The second * means every month.
  • The third * means every day of the week.
  • 0 represents Sunday.

@keonly
Copy link
Contributor Author

keonly commented Nov 29, 2023

테스트는 아직 해보지 못했습니다.. 혹시나 오류나면 다시 수정하겠습니다😭

@keonly keonly merged commit 6c377e9 into main Dec 1, 2023
2 checks passed
@keonly keonly deleted the feat-cron-scripts branch December 1, 2023 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant