Install crontab w/ script
This adds a couple of new scripts: install-crontab.sh and update.sh. The install-crontab script does exactly that -- it installs a new crontab that runs the update script every 5 minutes. An update script was added to simplify the crontab a bit and to ensure the Elixir update script is executed from the correct directory.
This commit is contained in:
parent
c627f4d402
commit
8ce5b04f51
3 changed files with 13 additions and 1 deletions
6
install-crontab.sh
Executable file
6
install-crontab.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Install crontab to run update script
|
||||
|
||||
SCRIPT_DIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||
|
||||
(crontab -l 2>/dev/null; echo "*/5 * * * * $SCRIPT_DIR/update.sh") | crontab -
|
|
@ -6,7 +6,7 @@ defmodule Instances do
|
|||
|
||||
def init() do
|
||||
File.rename(@update_file, "#{@update_file}-prev")
|
||||
update
|
||||
update()
|
||||
end
|
||||
|
||||
def request(url) do
|
||||
|
|
6
update.sh
Executable file
6
update.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
SCRIPT_DIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
mix run update.exs
|
Loading…
Add table
Reference in a new issue