Skip to content

Instantly share code, notes, and snippets.

@liquidgenius
Created July 23, 2021 16:10
Show Gist options
  • Save liquidgenius/c49d960772df0181d3f3fd33c3378328 to your computer and use it in GitHub Desktop.
Save liquidgenius/c49d960772df0181d3f3fd33c3378328 to your computer and use it in GitHub Desktop.

Revisions

  1. liquidgenius revised this gist Jul 23, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions run.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    #! /bin/bash

    # License: MIT; https://opensource.org/licenses/MIT
    # Version: 0.0.1
    # Maintainer: https://gist.github.com/liquidgenius

    # Given a script main.py on an ubuntu machine in /home/ubuntu/app/src directory with the interpreter
    # in /home/ubuntu/app/.venv directory in project. This script, run.sh, would be placed in the
    # /home/ubuntu/app directory.
  2. liquidgenius created this gist Jul 23, 2021.
    16 changes: 16 additions & 0 deletions run.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #! /bin/bash

    # Given a script main.py on an ubuntu machine in /home/ubuntu/app/src directory with the interpreter
    # in /home/ubuntu/app/.venv directory in project. This script, run.sh, would be placed in the
    # /home/ubuntu/app directory.

    # Consider adding run.sh to the Crontab to be run at 10 minute intervals with:
    # crontab -e
    # */10 * * * * cd /home/ubuntu/app && sudo sh run.sh

    appname="app"
    projdir="/home/ubuntu/$appname"
    cd "$projdir/src"
    PATH=/usr/local/bin:$PATH
    pipenv run "$projdir/.venv/bin/python" "$projdir/src/main.py"
    exit 0