[erlang-questions] problem running escript upon linux startup

Kris Prieb kris_prieb@REDACTED
Thu Apr 2 21:18:59 CEST 2009


Yup that did the trick.  Thanks again.

Kris Prieb

On Wed, Apr 1, 2009 at 5:55 PM, Kris Prieb <kris_prieb@REDACTED> wrote:
> Thanks!  I will try that.
>
> Kris Prieb
>
> On Wed, Apr 1, 2009 at 12:54 PM, Roger Critchlow <rec@REDACTED> wrote:
>> I believe that the %%! -env setting in the script takes place too late
>> to satisfy the erlang runtime.
>>
>> If the script is being launched from another script, inside
>> /etc/rc.local, then try this:
>>
>> HOME=/root path-to-escript
>>
>> or this:
>>
>> env HOME=/root path-to-escript
>>
>> which do the same thing, launch the command with the HOME environment
>> set to /root
>>
>> -- rec --
>>
>> On Tue, Mar 31, 2009 at 1:50 PM, Kris Prieb <kris_prieb@REDACTED> wrote:
>>> Hello list,
>>>
>>> The following escript fails when run upon linux (ubuntu) startup:
>>>
>>> #!/usr/bin/escript
>>> %% -*- erlang -*-
>>> %%! -env HOME /root
>>> main(_) -> file:write_file("/root/simple_start_output", "bunch of text").
>>>
>>> The program should create a file called "simple_start_output," under
>>> the root directory, but no such file appears when I log into the
>>> system.
>>> A look at /var/logsyslog/ reveals a "erlexec: HOME must be set"
>>> message resulting from the execution of the script.  The strange thing
>>> is that the script works fine when I run it after logging in.
>>>
>>> I've tried variations of the script such as:
>>>
>>> 1. using "/root" instead of /root when setting the HOME environment
>>> variable in the 3rd line of the script
>>> 2. excluding the 3rd line of the script entirely
>>> 3. using "/usr/bin/env escript" instead of calling "/usr/bin/escript"
>>>
>>> All scripts result in the same error,  "erlexec: HOME must be set,"
>>> when run at startup.  However, they all work when run after logging
>>> in.  Does anyone have an idea of how to get an escript to run at
>>> startup??  Any thoughts would be greatly appreciated.  Thanks!
>>>
>>> Kris Prieb
>>>
>>> (I should also mention that I am actually running the script at the
>>> launch of an Amazon EC2 virtual server, not on a machine that is
>>> physically in front of me.  Not sure if that matters one way or
>>> another.)
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>
>>
>



More information about the erlang-questions mailing list