3

I have a Mojolicious app that I would like to run automatically when the server starts. Normally, if I want to deploy the application, I use carton install to grab the appropriate dependencies, then I run carton exec -- hypnotoad script/myapp and I'm up and running.

I've created an init.d script that starts|stops the application by calling carton exec -- hypnotoad script/myapp, but Carton doesn't seem to be working properly. Instead, I get sudo: carton: command not found followed by a number of Can't locate <MODULE>.pm in @INC... errors.

How do I go about making Carton available to an init.d script? Or how do I run a Carton command from an init.d script?

Ryan Dunphy
  • 792
  • 2
  • 10
  • 33
  • See also [How to make `sudo` preserve $PATH?](https://unix.stackexchange.com/q/83191/45537) and [How to set path for sudo commands](https://superuser.com/q/927512/278134) – Håkon Hægland Dec 03 '19 at 10:18
  • 1
    In general it's a good idea to use the full path to each executable you run from init or cron scripts (in this case, that includes carton, hypnotoad, and script/myapp). – Grinnz Dec 03 '19 at 15:36
  • Full paths solved the problem. – Ryan Dunphy Dec 04 '19 at 00:30

0 Answers0