background-process

swift/ios refreshing app data when in background

拟墨画扇 提交于 2019-12-18 11:56:46
问题 I'm writing a iOS/Swift application which reads data from a REST service each X minutes and updates the UI accordingly. Now I would like that when the app is put in the background, a task keeps being invoked at X minutes intervals reading from the REST service and, in case the data just read satisfies a given condition, show a notification prompting the user to bring the app back to the foreground. In my searches I've read that during applicationDidEnterBackground event, I should start a task

launching background process in capistrano task

倾然丶 夕夏残阳落幕 提交于 2019-12-18 11:53:59
问题 capistrano task namespace :service do desc "start daemontools (svscan/supervise/svscanboot)" task :start, :roles => :app do sudo "svscanboot&" end end Now this doesn't work: the svscanboot process simply doesn't run. This helped me find sleep : https://github.com/defunkt/resque/issues/284 other sources pointed me to nohup , redirection , and pty => true , so I tried all these. run "nohup svscanboot >/tmp/svscanboot.log 2>&1 &" # NO run "(svscanboot&) && sleep 1" # NO run "(nohup svscanboot&)

ASP.NET Core IHostedService manual start/stop/pause(?)

寵の児 提交于 2019-12-18 11:47:48
问题 I would like to implement a recurring (timed) IHostedService instance in ASPNET Core that can be stopped and started on demand. My understanding is that IHostedService(s) are started by the framework on application startup. However, I would like to be able to start/stop the service 'manually', perhaps using an on/off toggle via a UI. Ideally the "off" state would dispose of currently running service, and the "on" state would then create a new instance. I've read the MS docs here: https://docs

How to return to bash prompt after printing output from backgrounded function?

≡放荡痞女 提交于 2019-12-18 10:56:15
问题 How can I return to my bash prompt automatically after printing output from a function that was put in the background? For example, when I run the following script in a bash shell: fn(){ sleep 10 echo "Done" exit } fn & After running the script, it immediately returns my prompt. After 10 seconds, it prints "Done" and then displays a blinking cursor on a new line: $ Done ▏ The script isn't running anymore, but I don't get my prompt back until I press Return . Is there any way to force a return

Background processes in Node.js

混江龙づ霸主 提交于 2019-12-18 09:58:08
问题 What is a good aproach to handle background processes in a NodeJS application? Scenario : After a user posts something to an app I want to crunch the data, request additional data from external resources, etc. All of this is quite time consuming, so I want it out of the req/res loop. Ideal would be to just have a queue of jobs where you can quickly dump a job on and a daemon or task runner will always take the oldest one and process it. In RoR I would have done it with something like Delayed

Google chrome extension: how to inject script immediately after page reload?

爷,独闯天下 提交于 2019-12-17 20:01:30
问题 I have a background script that periodically reloads the current tab. var code = 'window.location.reload();'; chrome.tabs.executeScript(my_active_tab, {code: code}); After each page reload, immediately I want to inject another script. chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab){ if (changeInfo.status == 'complete') { chrome.tabs.executeScript(tabId, { file: "my_script.js" }); } }); Above is the code I have at the moment. The thing is, it works but it is too slow,

AudioPlayerAgent, timer and webservice

巧了我就是萌 提交于 2019-12-17 16:51:41
问题 my application read a shoutcast. The meta data of the music played is collected from a webservice that return me a Json (so i don't have to decode the stream). I call the webservice every 20 seconds with a timer, this works in my application, but doesn't works in the AudioPlayer.cs //Timer private DispatcherTimer timer; /// <remarks> /// AudioPlayer instances can share the same process. /// Static fields can be used to share state between AudioPlayer instances /// or to communicate with the

Long running background PHP script blocks other PHP pages until it is finished

拟墨画扇 提交于 2019-12-17 12:19:51
问题 I made a long script in PHP as such: ignore_user_abort(true); set_time_limit(0); It runs perfectly in the background even if I close the page. My problem is that I can't open other PHP files until this script finishes running in the background. How can I solve this problem? 回答1: When a PHP script uses sessions, PHP locks the session file until the script completes. A page request that tries to use a locked session is blocked until the session file is released. PHP does this so that sessions

Keep a Service running even when phone is asleep?

允我心安 提交于 2019-12-17 03:51:08
问题 I have a Service in my application which is designed to run every 10 minutes. It basically checks up on our servers to see if everything is running properly and notifies the user of any problems. I created this application for internal use at our company. My co-worker used the application over the long weekend and noticed that no checks were performed when the device went to sleep. I was under the impression that the Service was supposed to keep running in the background until I explicitly

Keep a Service running even when phone is asleep?

假装没事ソ 提交于 2019-12-17 03:50:33
问题 I have a Service in my application which is designed to run every 10 minutes. It basically checks up on our servers to see if everything is running properly and notifies the user of any problems. I created this application for internal use at our company. My co-worker used the application over the long weekend and noticed that no checks were performed when the device went to sleep. I was under the impression that the Service was supposed to keep running in the background until I explicitly