script
Crontab issue for running script to start server
I am on ec2 instance ubuntu server and playing around with bash scripting. I have a very simple script which runs when the server reboots.
cd /home/ubuntu/d/web
echo "Start Phoenix server"** > server.log
whoami > server.log
date >> server.log
pwd >> server.log
source .env
mix phx.server >> server.log 2>&1
I got this error after the server reboots.
/home/ubuntu/startPhoenix.sh: 7: mix: not found
It works fine until the mix phx.server line.
I have this line in crontab -e file
@reboot /home/ubuntu/startPhoenix.sh
If I run the script like this, it works fine.
./startPhoenix.sh
What I don’t understand is why I am getting mix not found error.
I am using asdf for version control.
Any hint will be much appreciated.
Thanks.
Most Liked
hauleth
Cron do not set PATH so it doesn’t know where mix is.
However I would suggest you to use releases for production deployments instead of running mix phx.server and to start such release via systemd (or other system supervisor of your choice).
2
Popular in Questions
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Other popular topics
I would like to know what is the best IDE for elixir development?
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









