[erlang-questions] run_erl logfiles and cron

Dmitry Kolesnikov dmkolesnikov@REDACTED
Thu Nov 28 07:52:37 CET 2013


Just curious, why are you using cron to start application after reboot? There is a nice service utility that is capable to restart all background applications. 

Best Regards,
Dmitry >-|-|-*>


> On 28.11.2013, at 5.35, Jay Doane <jay@REDACTED> wrote:
> 
> Daniel,
> 
> Great clue!  A search for "pseudo tty cron" led me to this link: https://www.linuxquestions.org/questions/linux-server-73/running-process-from-cron-with-ptty-588635/, and an eventual solution like this:
> 
> @reboot screen -d -m ~/my_proj/rel/my_proj/bin/my_proj start
> 
> Thanks,
> Jay
> 
> 
>> On Wed, Nov 27, 2013 at 4:29 PM, Szoboszlay Dániel <dszoboszlay@REDACTED> wrote:
>> Hi,
>> 
>> That's because cron doesn't allocate a pseudo tty for your program, so your node starts up with the old shell. (Hopefully some Linux guru will know how to fix it, but I have no idea.)
>> 
>> BR,
>> Daniel
>> 
>> On Wed, 27 Nov 2013 23:23:07 -0000, Jay Doane <jay.s.doane@REDACTED> wrote:
>> 
>> Hi,
>> 
>> As an expedient, when the host is booted, I'm starting an erlang project with cron using something similar to the following in a crontab:
>> 
>> @reboot ~/my_proj/rel/my_proj/bin/my_proj start
>> 
>> where my_proj is built using "rebar compile generate".
>> 
>> While this *does* actually start the erlang project, the "run_erl" logfiles it generates differ from those that are generated when the project is started from the command line using the same command; each log entry is suffixed with a (node@REDACTED)1> prompt.
>> 
>> For example, here's a snippet of log started via cron (weird suffixes highlighted in red)
>> 
>> Eshell V5.9.2  (abort with ^G)
>> (my_proj@REDACTED)1>
>> =INFO REPORT==== 27-Nov-2013::19:41:54 ===
>> Registering 0 remote connections on node 'my_proj@REDACTED'(my_proj@REDACTED)1>
>> =INFO REPORT==== 27-Nov-2013::19:41:54 ===
>> Node 'my_proj@REDACTED' connected with 0 users(my_proj@REDACTED)1>
>> 
>> And the same snippet later when started from bash:
>> 
>> Eshell V5.9.2  (abort with ^G)
>> (my_proj@REDACTED)1>
>> =INFO REPORT==== 27-Nov-2013::19:56:42 ===
>> Registering 0 remote connections on node 'my_proj@REDACTED'
>> =INFO REPORT==== 27-Nov-2013::19:56:42 ===
>> Node 'my_proj@REDACTED' connected with 0 users
>> 
>> Can anyone give me any clues as to why this might be happening, and especially suggestions on how to stop it?
>> 
>> Thanks,
>> Jay
>> 
>> 
>> 
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131128/8f985778/attachment.htm>


More information about the erlang-questions mailing list