How to check if background script has stopped with Rails? - ruby-on-rails

I have a script which keeps running on a screen as background job continuously on my Ubuntu server. But sometimes if some error occurs it can stop. Is there any way by which I can monitor it and get some alert when it stops instead of manually logging and checking that the script is running or not ??
I am running my server on Linode and Ubuntu is 10.04 server edition.

Related

Running applescript during laptop sleep ends with error

So I have an applescript (from https://apple.stackexchange.com/questions/370531/catalina-backup-ios-devices-programatically/370850#370850?newreg=14a167f68b6b4b4faa86c0877fb000ba) that backs up my iphone over wifi.
It works perfectly when running manually.
Now, I want to schedule them periodically (daily) at some hour in the night.
I've tried using launchd and periodic services, but when they run the script in the night when laptop is sleeping, I get: "execution error: System Events got an error: Application isn’t running. (-600)"
Not sure what is not running - System Events or the Finder??
Any idea how to make the script work when lid is closed?

Docker for Windows auto startup

I've installed Dockers for Windows. Every time I start my computer it does not start up properly. I am always faced with this dialog.
I've tried starting and stopping the service, but it never seems to startup properly upon windows startup.

What happens to TFS Build service when running in Interactive Mode?

I am trying to setup a build agent to build my Win8 app, which I'm told I should be able to do on a Server 2012 machine.
Everything was going well, until the step told me to stop the build service and run it in 'interactive mode'.
What this appears to do, it make the service run with a command prompt saying "I'm running in interactive mode, press escape when done" (When I pressed escape the build service stopped).
My question is this, if I need to run the build service in interactive mode for win8 builds, how will I cope for the inevitable situation when the server restarts, or some admin logs the user out? presumably the build service will stop.
Is there a better way to handle this?
unless there is a specific reason why you need to run in interactive mode, i was building win8 apps all last year on a 2012 server running with out interactive mode and it ran fine. try it without and see what happens

Proper way to start nginx/passenger (non-standalone) on Ubuntu with Rails 3?

I configured my Rails 3 production app about 6 months ago on Ubuntu running nginx/passenger, using git and Capistrano for deployment.
Fast forward to last week - The data center I was using (DigitalOcean NYC) actually had a complete power failure (and the battery backup didn't work) - resulting in my server shutting completely down.
I did not set passenger or mysql to start on reboot, so when the hardware server restarted, my app was still down.
I really did not know much about what I was doing at the time when I launched it (since it was my first production server that I have worked with), and I followed a guide to get it up and running.
When I attempted to get the app running again, I managed to start mysqld no problem - but for the life of me couldn't remember how to get nginx/passenger running again.
Since time was of the essence (my client needed the app up and running ASAP), I ended up getting the app back up and running by navigating to my app directory (/current) and using the command:
passenger start -p 80 -e production
This did the trick but actually started Passenger Standalone. It seems to work fine (it is not a big or complicated app at all, maybe a few users at a time). I can navigate back to my directory and start and stop it using the above command (and passenger stop -p 80).
However, now my capistrano deploy (cap deploy) no longer restarts the server on a deploy (it is trying to run touch tmp/restart.txt) - which even if I try to run manually, does nothing since the server is running Passenger Standalone.
I can't remember how I got the server up and running in the first place because it was so long ago. I'm not using RVM - just the version of Ruby running directly on the server.
Does anyone know the correct command to start nginx/passenger (not standalone) on Ubuntu?
And even a step further - how I can get mysqld and nginx/passenger to automatically load on a hard server restart?
Capistrano does not restart the server because it actually creates a new app directory (/u/apps/.../releases/xxx), while Passenger Standalone is still running in the old app directory (/u/apps/.../releases/yyy). Therefore touching restart.txt doesn't work. Instead, you have to restart Passenger Standalone like this:
cd /path-to-previous-release && passenger stop -p 80
cd /path-to-current-release && passenger start -p 80 -e production
You mentioned you want to start nginx/passsenger. I assume that you mean the Nginx mode. Here's what you need to do:
Install Phusion Passenger using the official Passenger APT repository.
There is no step 2. If you did step 1, then the Ubuntu package will automatically configure Nginx to start at system boot, which will automatically start Passenger as well.
I don't understand why you ask how you can get mysqld to automatically start on a hard server restart. Mysqld is always started during system boot. You don't have to do anything.

Rails application access is very slow

We are trying to access a Rails application running on a Ubuntu machine from a Windows machine and the time it takes to load the application is extremely slow. The ping operation from the Windows machine to the Ubuntu machine comes back in < 1ms. How do I debug this issue?
If you are running your rails applications with command 'rails server' which by default a webrick, it will take time for other machines to load, try installing the application in apache server within your ubuntu machine and access it with your system ip and the symlink.(http://0.0.0.0/symlink) For the first time when you restart your apache server, it will take time and then it should load in shorter time than in webrick.

Resources