Running a meteor.js application forever - meteor

I have a personal localhost meteor application running on my laptop which silently stops running every time the computer goes to sleep. The way I run it simply using the "meteor" command, after which i background and disown the process and close terminal.
Is there a way to prevent the app from stopping, to have it run forever on my machine unless i explicitly close it?

You need to create a server daemon for your application in the same way you'd do on a production server. There are several ways to do this, probably the easiest one is to use demeteorizer to create a plain Node.js program with your app, and then run it with forever.

Related

Rscript slave call doesn't exit properly

I have a Desktop Entry that calls a shiny app.
Here's my desktop entry
[Desktop Entry]
Type=Application
Comment=App
Name=App
Exec=/usr/bin/Rscript -e "shiny::runApp('~/raspberry_IP/app.R', launch.browser=TRUE)"
Icon=/home/path/to/logo/rpi_logo.png
Terminal=false
Categories=Utility
StartupNotify=true
This runs well and the Shiny application works as expected. However, when I close my browser tab, I see the process is still running.
I am running this application from Ubuntu 20.04 LTS.
If I change my terminal=false to terminal=true. I see that the output of my terminal freezes (the app no longer updates, hence no diagnostic printing). But the terminal is still active (which makes sense given the process is still running). I can CTRL+C out of it to kill it from my terminal, but that's not the desired user behavior.
I see some strategies to stop the app using stopApp() like here. This strategy uses a separate action button to kill the app, so the user has to "manually" stop it. This might work, but I believe it's natural for the user to try to close the tab or Browser (and there's no way for them to know the process is still running, unless they check).
Using this on the server side, does kill the process, but it's recommended against (see here).
session$onSessionEnded(stopApp)
In this case, because my app is running on a local machine, I think I could potentially get away with this (there is only one user at a time), but I was wondering whether there's better practice to implement.

.net core console application on PCF

I'm able to deploy a .net core console app on PCF which raises some internal events and runs for sometime(with help of Thread.Delay()) and exits. I want to be able to start and stop this app remotely, using a batch file from windows machine.
When I push this app to PCF I have explicitly put --no-start flag in the push command. The app gets deployed and doesn't starts and I can start this remotely with cf start command. Once it exits successfully PCF tries to restart it considering it as crashed so in order to restart i would first need to cf stop and then use start command.
I need help in understanding - if there is any other better way to do this. Originally we were planning to use Tasks on PCF; but as per my understanding Tasks are command which runs on other application(please correct me if I am wrong)
Any thoughts will help.
Thanks in advance.
I modified my app logic to achieve this. I did the following -
Deployed app with --no-start flag
In the app entry method I checking the value of arg passed from command line
if arg==required_key then run the job else return
I do a cf start which builds, stages the app and the app gets started but no results displayed on console
cf stop
cf run-task APP_NAME "dotnet appname.dll required_key"
The above task runs one time and destroys itself.

Running gulp as a service

We have a project where the developers (from what I understand) use gulp to run a website locally using Vagrant. They want to deploy this website on an AWS instance.
We are trying to implement the commands using Jenkins. The website stays up while gulp serve-dev is running, but then Jenkins times out and Nginx returns a 502 error. Of course we can prevent Jenkins from timing out but then the job would need to keep running.
Is there away to run this command as a service? any other way we can go about this ?
You want to run gulp in the backgroud without stoppping when you close terminal or log out from the server.
Try using nohup(short for no hangup) which runs command with hangup ignored so that your command continue running even if you logout from the server
try running it using nohup gulp serve-dev &
& put command in background mode so that you can continue using the current shell screen.
Cheers!

KIBANA 4 process gets stopped on closing the putty window

I am using kibana-4.0.0-beta3 version on linux machine. The process gets stopped automatically on closing the putty window. Is there any way to run the process in back-end?
Yes. As with any unix process, the basics would be to use 'nohup' and put the process in the background. You should write a startup script (e.g. /etc/init.d/kibana4) that is similar in form to other startup scripts on your system.
Here is a kibana4 startup script for debian, simply place it in /etc/init.d/kibana , then run:
/etc/init.d/kibana start
set it to start on boot:
update-rc.d kibana defaults
https://github.com/akabdog/scripts/blob/master/kibana4_init
Use a program called screen to run anything in a shell. Then detach from the terminal session but keep the processes running. When you reconnect you can reconnect to the session and interact with them.
Run with nohup
nohub ./bin/kibana
bin/kibana > abc.txt &
This will run kibana in backend and redirect its logs to abc.txt. works like a charm for me :-)

How to detect whether a asp.net script is already running?

i want to create a script that would run forever. i mean i start the script today, and i should be able to see it running even in the next year.
this would not be possible because of the sever errors. it is obvious that the script will stop at least within 2 or 3 hours due to the server faults(im using a free web server).
so the method im going to use is to run two (or more) scripts simultaniously in two severs, and one scripts cheks if the other is runing & viceversa for every 30 seconds. and if found not running it executes the other one.
so the scripts will run as long as both of them are not stopped at once
1.my question is how do i check if the other asp.net script is running?
2.at least is there a way to check if another intance of the same asp.net script(in the same server) is already running?
i want to create a script that would run forever
ASP.NET is not the tool for this. A web application is a request/response system. It intercepts requests, performs a finite amount of processing, and returns a response. At that point it's done. Additionally, web servers are free to allocate and de-allocate resources for a number of reasons, so at any time your web application can be shut down.
What you're looking for is something more like a Windows Service or perhaps a Console Application (backed by a scheduler or something else to ensure that it's running). Web applications by design don't "run forever" so they're not the right tool for the job.
ASP is not free but it is also not too expensive, we can run a script on server that can continuously work on server, but doing such thing on server can cause server load error, and will affect other websites which are hosted on shared hosting. You can go for VPS hosting, But I think that your server administrator can suspended your account on running such kind of script on server.

Resources