Queues in Laravel 4.2 [closed] - laravel-4

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I am working in a project developed on Laravel 4.2.
I am not able to get the idea about queuing service of laravel. I have read many documents about it but still things are not clear.
Should I compare Queue and cron job ?
when we put a cron job on server, We mention a time when the cron will run. But in the case of queue I could not find the place where time of run is mentioned.
There are some files in App/command directory and code is running on my server but I am helpless to find the time of run OR how to stop these queues.
Please guide me about this problem.

Queue is a service where you add the tasks for later.
Generally you ask other service provider like iron.io to call your application to have the task processes asynchronously and repeat the call if it fails the first time. This allows you to respond to the application user quickly and leave the task to be processed in the background.
If you use local sync driver then task will be done immediately during the same request.

Related

Laravel check if artisan command is running which triggers an SSE [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm using a privately made SDK by some company where I have to get messages from using an SSE stream. Right now I run my function in my controller which sends a GET to the server and keeps the connection alive. I'm triggering this from my console. I've made a command php artisan fetch:messages which starts calls my controller method and starts the connection.
Right now, if I close my console the SSE stream also closes. How can I keep this alive when I'm away? Because this has to be active at all times.
I tried making a laravel schedule that triggers php artisan fetch:messages command every few minutes but I cannot see if the previous command is active or not.

Should a Go app panic if it doesn't find external dependencies/services [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
How should a Golang app handle missing external dependencies ?
When a app starts and it doesn't find the database it is supposed to persist the data on, knowing the app is useless in that state, should I panic the app ?
I can otherwise log infinitely something, print to stderr, or use another method to notify, but I'm not sure when to choose each method.
An application that has no access to the external network service should not panic. This should be expected as networks tend to fail. I would wrap the error and pass it further.
Consider the following scenario. You have multiple application servers connected to two database servers. You are upgrading the database servers one at a time. When one is turned off half of your application servers panicked and crashed. You upgrade the second database server and every application server is gone now. Instead, when the database is not available just report an error for instance by sending HTTP status 500. If you have a load balancer it will pass the request to the working applications servers. When the database server is back, the application servers reconnect and continue to work.
Another scenario, you are running an interactive application that processes a database to create a report. The connection is not available. The application panicked and crashed. From the user perspective, it looks like a bug. I would expect a message that connection cannot be established.
In the standard library it is accepted to panic when an internal resource is not available. See template.Must. This means something is wrong with the application itself.
Here's an example from the Go standard library.
Package crypto
import "crypto"
func (Hash) New
func (h Hash) New() hash.Hash
New returns a new hash.Hash calculating the given hash function. New
panics if the hash function is not linked into the binary.

Schedule ec2 instance start/stop [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to schedules the time, around which an ec2 instance starts/stops? Is it possible to do it without using cron, aws data pipeline or Lambda? I am trying to create a shell script to automate this task. Please suggest!
Here is a Lambda function which will help you start or stop any instance which have correct tags with start and stop values.
https://gist.github.com/gregarious-repo/b75eb8cb34e9b3644542c81fa7c7c23b
You just need to create new function with proper permission and trigger it by the CloudWatch event which will execute every minute.
Once you have it up and running your instance tags should look like below:
You can use a shell script along with aws cli to get this done.
Incase your ec2 instance is in an auyo scaling setup or if you can place it in an auto scaling setup, you can use the scheduled autoscaling featute as well. You can read about scheduled auto scaling feature here.
http://docs.aws.amazon.com/autoscaling/latest/userguide/schedule_time.html
Note: Auto scaling feature is free to use and coats only for resources that is used up. You may place single instance setups also in auto scaling setup with minimum value set to 0 and use scheduled autoscale feature to get your purpose served.

email alerts for Windows Services [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
How can I set an e-mail alert for Starting & Stopping Windows Service?
I have Tomcat running in Windows Server 2008 R2 as Service, I want to setup e-mail alerts whenever the service starts/stopped/re-started.?
is there any Powershell commands? Any Windows event based triggers?
There are many solutions possible (like using Nagios to monitor service status and send an alert).
If you want to use PowerShell...
SOLUTION1: Use Recovery tab to schedule an action ("Run a program"). That action should be a PowerShell script that sends your email...
NOTE: As Jacob kindly said in a comment, action will be triggered only if the service stops by an error.
SOLUTION2: Another possible solution is having a Schedule Task every x time (your choose... 1 min is the minimum) that runs a PowerShell Script. That scripts would:
Check Service Status and compare with previous state (use Get-Service cmdlet)
If the state changes, change previous state and send an email.
You can find here someone that had exactly the same problem and fixed it with Powershell.
Instead of scheduling a recurring task as #cad suggests, you can create a task that will be triggered based on the eventlog :
you could configure it to start on event 7036 of source Service Control Manager from System logfile.
This task can run a powershell script where you can send mail. Short example
Get-EventLog -LogName system -Source "service control manager" -After (get-date).AddMinutes(-5) |?{$_.message -match "tomcat"} | select timegenerated, message
You may want to look into creating a WMI eventing (Win32_Service Class). I haven't used this feature in quite a long time but it look like powershell is making it easier now. This would provide immediate alerting and not require a separate polling process.
https://devblogs.microsoft.com/scripting/an-insiders-guide-to-using-wmi-events-and-powershell/

Avoiding SSH timeouts on Mac OS? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Every time I connect to a server with ssh, the connection is reset after a few minutes if there is no input. However, I want to remove these timeouts as to keep the connection alive for as long as possible.
By looking on different forums, I saw it was possible to modify the ServerAliveInterval option in the /etc/ssh_config file. However, there doesn't seem to be this option in my file. Where could it be?
I'm running OpenSSH_5.2p1 on Snow Leopard.
Thanks!
Server Alive interval simply sends a null packet to the server at a set time to keep the connection alive, you should just be able to add some thing like into your config file: ~/.ssh/config
Host *
ServerAliveInterval 60
The second line must be indented with at least one space.
* will match any host; if you wanted you could restrict this to particular destinations like *somedomain.com.
Check out http://kehlet.cx/articles/129.html

Resources