Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nathanl's full-sized avatar

Nathan Long nathanl

View GitHub Profile
@nathanl
nathanl / periodic_task.ex
Created June 29, 2017 16:34 — forked from trestrantham/periodic_task.ex
Run a task periodically natively in Elixir
defmodule MyApp.Periodically do
use GenServer
def start_link do
GenServer.start_link(__MODULE__, %{})
end
def init(state) do
Process.send_after(self(), :work, 2 * 60 * 60 * 1000) # In 2 hours
{:ok, state}
#!/bin/sh
set -e
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/deploy/taxscribe/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
CMD="/usr/local/bin/unicorn --config-file $APP_ROOT/config/unicorn.server.rb --env production --daemonize $APP_ROOT/config.ru"
action="$1"