daemon

Building Daemon or Service Apps with Office 365 REST API in Java

纵然是瞬间 提交于 2019-12-11 02:12:20
问题 I am trying to build a batch job to access Office 365 Mail API. Up on checking the documentation (the concept is very clear), I wasn't able to find a code sample written for Java. I've found this but it relies on the java pom file but I would love to use REST API or Graphi API directly if possible. Can someone point me on how to get started with building a Daemon service to access Office 365 REST API without users login ? UPDATE I've the following code to get the token using AADL library

Managing Signal Handling for daemons that fork()

帅比萌擦擦* 提交于 2019-12-11 00:44:43
问题 I want to write a robust daemon in perl that will run on Linux and am following the template described in this excellent answer. However there are a few differences in my situation: First I am using Parallel::ForkManager start() and next ; to fork on an event immediately followed by exec('handle_event.pl') In such a situation, I have the following questions: Where should I define my signal handlers. Should I define them in the parent (the daemon) and assume that they will be inherited in the

Daemon Thread in Javascript

扶醉桌前 提交于 2019-12-10 23:53:09
问题 I have a program that gets a JSON from the server using getJSON and processes this data and presents it to the user. But the data on the server is being updated every so often. How can I get the new JSON every 5 minutes and display it to the user and do it in a background thread? Can I use setTimeout for this? Thanks! Matt 回答1: Using an interval that fires every 5 minutes is the obvious (and most browser-compatible) approach. This does not create a separate thread, but is the traditional

Why does this Ruby code fail to write to the log file?

ε祈祈猫儿з 提交于 2019-12-10 21:39:28
问题 Once the script is daemonized then the logger can't write to the file anymore. So how and when should I initialise the log? require 'rubygems' require 'daemons' require 'logging' def create_new_logger logger = Logging.logger['trend-analyzer'] logger.add_appenders( Logging.appenders.rolling_file('./logs/trend-analyzer.log'), Logging.appenders.stdout ) logger.level = :debug return logger end logger = create_new_logger #this log message gets written to the log file logger.debug Time.new Daemons

php daemon possible memory leak

亡梦爱人 提交于 2019-12-10 18:43:48
问题 i've written a daemon in php and want to make sure it doesn't leak memory, as it'll be running 24/7. even in its simplest form memory_get_peak_usage for a daemon will report that the script consumes more memory for each cycle. memory_get_usage on the other hand will not grow. the question is: should i worry? i've stripped down the daemon to the bare basics but this is still happening. any thoughts? #!/usr/bin/php -q <?php require_once "System/Daemon.php"; System_Daemon::setOption("appName",

How to keep my program alive for as long a daemon thread is running?

筅森魡賤 提交于 2019-12-10 18:39:00
问题 I have a requirement, that I want to start a poller once which will run foreever until the machine is restarted or the process is being killed. Now, I tried to start the poller from a main method using a shell script, but the problem is that as soon as the main method completed its execution, the poller also stoped working, as i am not using any servers to achieve so. I heard something about daemon threads , but I am wondering how to create a daemon thread, which will run forever, and help my

Why won't my perl daemon print?

房东的猫 提交于 2019-12-10 17:47:01
问题 I am debugging a daemon and I'm trying to use print statements to output information to the terminal. The gist of my code is: #!/usr/bin/env perl use strict; use warnings; use Readonly; Readonly my $TIMEOUT => ...; ... while (1) { print "DEBUG INFO"; ... sleep $TIMEOUT; } However, no output it getting printed to my terminal. Why is this? 回答1: Summary: Use $| = 1 or add a newline, "\n" to the print. Explanation: The reason this isn't printing to the terminal is because perl is buffering the

DI in .NET Core without ASP.NET Core

妖精的绣舞 提交于 2019-12-10 14:23:33
问题 I'm looking to write a daemon process using .NET Core which will basically act much like a chron job and just orchestrate API/DB calls on some interval. As such, it has no need to expose any web routes, so there's no need for ASP.NET Core. However, afaik ASP.NET Core is where you get that nice Startup class with all the DI plumbing and environment-based configuration you might need. The way I see it, I have two options: Forgo ASP.NET Core and just hook up the DI framework on my own. If I go

C# service as a daemon in debian with mono-service

梦想的初衷 提交于 2019-12-10 11:54:10
问题 I can't seem to find a way to get a C# service run as a "service" in debian. What Am I doing wrong? I followed this post from msdn to create a sample windows service : http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.80).aspx I can run the service at my windows machine, Start and stop the service and see that it writes to MyNewLog. Then I copy it (.exe file) to my debian machine and tries to run it with (as root) mono-service MyNewService.exe The Syslog tell's me that the service have

launchd: sleep in GCD managed signal handler

那年仲夏 提交于 2019-12-10 11:39:34
问题 I encounter a strange situation in a launchd managed daemon when I try to sleep in the SIGTERM handler that is managed with Grand Central Dispatch as described here. Everything works fine and I do get a SIGTERM signal handler before receiving a SIGKILL when I do not sleep in the SIGTERM handler. But as soon as I do sleep -- even for extremly short amounts of time like a usleep(1); -- I do not get a SIGTERM handler at all but instead my daemon is SIGKILLed instantly by launchd. Btw I am using