The better way would be to use nohup <https://linux.die.net/man/1/nohup>,

like following

nohup java -jar app.jar server app.yml > /dev/null 2> /dev/null < /dev/null &


In the above command,

nohup - Eats all the hangup commands sent via terminal or session closing, 
so you java command never gets them
& at the last makes sure you still run it as background process
redirect output, error and input streams to null so that services like AWS 
CodeDeploy dont block on commands execution.

I have been using the exact same command as above in production for more 
than a year now, works like a charm for me :)

On Monday, February 27, 2017 at 12:48:22 PM UTC+5:30, karthik sk wrote:
>
>
> Yes It worked for me too. Thanks a lot. I am still wondering if there is 
> any alternative solution to this, since I am not sure if running the 
> application as root is secure. 
>
> On Monday, February 27, 2017 at 10:45:09 AM UTC+5:30, Thej Kamal Rao 
> Menneni wrote:
>>
>> Hi,
>>
>> Running as 'root' solved the problem. I guess session timing out after 
>> some interval. Let me know if you face any other issue.
>>
>> Regards,
>> Thej
>>
>> THEJ KAMAL RAO MENNENI <https://twitter.com/TejaMenneni> | Software 
>>  Engineer <https://in.linkedin.com/in/thejmenneni>|8123635251| 
>> NowFloats.com <http://nowfloats.com/>| @NowFloats 
>> <https://twitter.com/NowFloats>
>>
>> We are uncovering #deshruption <https://twitter.com/hashtag/deshruption> 
>> across 
>> India. To know more follow @DigitalDesh <http://twitter.com/digitaldesh>
>>
>> On Sat, Feb 25, 2017 at 5:56 PM, karthik sk <[email protected]> wrote:
>>
>>> Hey i am having a similar problem. Did running it as root solve it? and 
>>> Did you figure out why it is happening? Thanks in advance.
>>>
>>> On Monday, February 6, 2017 at 3:40:32 PM UTC+5:30, Thej Kamal Rao 
>>> Menneni wrote:
>>>>
>>>> It helps a lot Vaibhav. Now I am running now as root and will check. 
>>>>
>>>> Regards,
>>>> Thej
>>>>
>>>> THEJ KAMAL RAO MENNENI <https://twitter.com/TejaMenneni> | Software 
>>>>  Engineer <https://in.linkedin.com/in/thejmenneni>|8123635251| 
>>>> NowFloats.com <http://nowfloats.com/>| @NowFloats 
>>>> <https://twitter.com/NowFloats>
>>>>
>>>> We are uncovering #deshruption 
>>>> <https://twitter.com/hashtag/deshruption> across India. To know more 
>>>> follow @DigitalDesh <http://twitter.com/digitaldesh>
>>>>
>>>> On Mon, Feb 6, 2017 at 3:24 PM, Vaibhav Dhawan <[email protected]> 
>>>> wrote:
>>>>
>>>>> Hi, 
>>>>>
>>>>> For me it was related to the user with which i was running the 
>>>>> service. As soon as the ssh session would time out , the service would 
>>>>> stop, even if it was started as a background process.
>>>>>
>>>>> As soon as i shifted to root/similar user, the problem went away. 
>>>>>
>>>>> Thanks
>>>>> Vaibhav Dhawan
>>>>>
>>>>> On Mon, Feb 6, 2017 at 3:21 PM, <[email protected]> wrote:
>>>>>
>>>>>> Hi Vaibhav,
>>>>>>
>>>>>> I am facing similar problem. I was running it as a background process 
>>>>>> but still it shutdown after some time. Please help how you resolved it. 
>>>>>> Thanks in advance.
>>>>>>
>>>>>> Regards,
>>>>>> Thej
>>>>>>
>>>>>> On Wednesday, September 21, 2016 at 11:48:01 AM UTC+5:30, Vaibhav 
>>>>>> Dhawan wrote:
>>>>>>>
>>>>>>> Was able to get through this finally. Still not sure what caused it 
>>>>>>> but started the DW process as a service on my Ubuntu and it hasnt 
>>>>>>> crashed/stopped since.  
>>>>>>>
>>>>>>> Thanks
>>>>>>> Vaibhav 
>>>>>>>
>>>>>>> On Saturday, 3 September 2016 13:50:30 UTC+5:30, Vaibhav Dhawan 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hello, 
>>>>>>>>
>>>>>>>> I am on Dropwizard 1.0.0 , Java 1.8 and have a few services running 
>>>>>>>> in there. Since the services are not in production yet, hence there 
>>>>>>>> are 
>>>>>>>> periods when no one is accessing those services. 
>>>>>>>>
>>>>>>>> What i notice is that Jetty shuts down automatically and gracefully 
>>>>>>>> after some period of inactivity. The inactivity period is not 
>>>>>>>> consistent 
>>>>>>>> and it goes down at random times. Here is an excerpt from the logs
>>>>>>>>
>>>>>>>> DEBUG  [12:34:34.693] [dw-21] o.e.j.u.t.QueuedThreadPool -  ran EPC 
>>>>>>>> Prod/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@432959e3
>>>>>>>> DEBUG  [12:57:24.162] [Thread-13] o.e.j.u.c.AbstractLifeCycle - 
>>>>>>>>  stopping org.eclipse.jetty.server.Server@46e3559f
>>>>>>>> DEBUG  [12:57:24.162] [Thread-13] o.e.j.s.Server -  doStop 
>>>>>>>> org.eclipse.jetty.server.Server@46e3559f
>>>>>>>> DEBUG  [12:57:24.164] [Thread-13] o.e.j.s.Server -  Graceful 
>>>>>>>> shutdown org.eclipse.jetty.server.Server@46e3559f by
>>>>>>>> DEBUG  [12:57:24.164] [Thread-13] o.e.j.u.c.AbstractLifeCycle - 
>>>>>>>>  stopping application@21c747a{HTTP/1.1,[http/1.1]}{0.0.0.0:8090}
>>>>>>>> .
>>>>>>>> .
>>>>>>>> .
>>>>>>>> .INFO   [12:57:24.221] [Thread-13] o.e.j.s.h.ContextHandler - 
>>>>>>>>  Stopped 
>>>>>>>> i.d.j.MutableServletContextHandler@5bfa8cc5{/,null,UNAVAILABLE}
>>>>>>>> DEBUG  [12:57:24.221] [Thread-13] o.e.j.u.c.AbstractLifeCycle - 
>>>>>>>>  STOPPED 
>>>>>>>> i.d.j.MutableServletContextHandler@5bfa8cc5{/,null,UNAVAILABLE}
>>>>>>>>
>>>>>>>>
>>>>>>>> This time it went down after 23 minutes of inactivity, there are 
>>>>>>>> times it goes doen after 6 minutes, 12 minutes etc. 
>>>>>>>> Any clues? Should i have a dummy service which simply pings every 
>>>>>>>> minute to keep it alive. I have used 0.9.2 for a 6 months and never 
>>>>>>>> faced 
>>>>>>>> this issue earlier. 
>>>>>>>>
>>>>>>>> Any pointers are appreciated. 
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Vaibhav
>>>>>>>>
>>>>>>> -- 
>>>>>> You received this message because you are subscribed to a topic in 
>>>>>> the Google Groups "dropwizard-user" group.
>>>>>> To unsubscribe from this topic, visit 
>>>>>> https://groups.google.com/d/topic/dropwizard-user/4L-k1tgPOm0/unsubscribe
>>>>>> .
>>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>>> [email protected].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Thanks
>>>>>
>>>>> Vaibhav Dhawan 
>>>>> +919871488896
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to a topic in the 
>>>>> Google Groups "dropwizard-user" group.
>>>>> To unsubscribe from this topic, visit 
>>>>> https://groups.google.com/d/topic/dropwizard-user/4L-k1tgPOm0/unsubscribe
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>> [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "dropwizard-user" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/dropwizard-user/4L-k1tgPOm0/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to