Skip to content

Instantly share code, notes, and snippets.

@m-cakir
Created October 13, 2022 11:22
Show Gist options
  • Select an option

  • Save m-cakir/aa1d68833e6369e44b147558cfde4c7b to your computer and use it in GitHub Desktop.

Select an option

Save m-cakir/aa1d68833e6369e44b147558cfde4c7b to your computer and use it in GitHub Desktop.

Revisions

  1. m-cakir created this gist Oct 13, 2022.
    10 changes: 10 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    version: '3.1'

    services:
    snscrape:
    image: alpine:latest
    volumes:
    - ./:/usr/src/app
    working_dir: /usr/src/app
    entrypoint:
    - ./entrypoint.sh
    12 changes: 12 additions & 0 deletions entrypoint.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/sh

    chmod +x task.sh

    echo "* * * * * /bin/sh /usr/src/app/task.sh >> /usr/src/app/task.log 2>&1
    # This extra line makes it a valid cron" > task-scheduler.txt

    crontab task-scheduler.txt

    touch task.log

    crond && tail -f task.log
    5 changes: 5 additions & 0 deletions task.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/bin/bash

    timestamp=`date +%Y/%m/%d-%H:%M:%S`

    echo "[task] system path is $PATH at $timestamp"