background-process

Running a command as a background process/service

雨燕双飞 提交于 2019-12-04 17:40:35
问题 I have a Shell command that I'd like to run in the background and I've read that this can be done by suffixing an & to the command which causes it to run as a background process but I need some more functionality and was wondering how to go about it: I'd like the command to start and run in the background every time the system restarts. I'd like to be able to able to start and stop it as and when needed just like one can do service apache2 start . How can I go about this? Is there a tool that

Get Java Runtime Process running in background

孤者浪人 提交于 2019-12-04 15:40:26
I'm writing a java application where I require to run a process in background throughout the lifetime of the running application. Here's what I have: Runtime.getRuntime().exec("..(this works ok).."); Process p = Runtime.getRuntime().exec("..(this works ok).."); InputStream is = p.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); So, basically I print out every br.readLine() . The thing that I'm not sure about is how to implement this code in my application because wherever I put it (with Runnable), it blocks other code from

How to launch a job in a shell which will persist even if the shell which launches it terminates

走远了吗. 提交于 2019-12-04 15:27:25
How do I lauch a job in a Linux shell, so that even if the shell which launches it terminates, this job will still persist? More specifically, I am trying to run strace on a process. It runs perfectly if I do it in a terminal. However, I want to do it in a remote shell which will stop as soon as all the commands have been executed. "strace -p pid &" doesn't have any effect because when the shell stops, the background job also gets killed. How should I do it? nohup seems to be thing I am looking for. However, ssh user@remote_machine script_name doesn't seem to have any effect neither. In the

Placing a process in the background in C

為{幸葍}努か 提交于 2019-12-04 13:34:01
问题 I'm currently diving into creating a backgrounding a job in C with & . I need to implement a non-blocking waitpid in order for this to work. I know that. Also, I already am catching the condition if & is entered at the end of the command line. I'm just not sure how to exactly send the process with the end to be a background job and also implement it as executing while another prompt is prompting for the next command. Anything would help at all, thank you. struct bgprocess{ int pid; struct

iOS background fetch time limit crash

本秂侑毒 提交于 2019-12-04 12:46:08
I've set up background fetch, using outline from NSScreencast episode #92 . - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... [application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; ... } - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if ([[MyAppAPIClient manager] reachable] && [[Session manager] userSignedIn]) { [[[Session manager] user] fetchBackgroundWithSuccess:^(NSURLSessionDataTask *task,

CodenameOne background task for BluetoothLe connection

落爺英雄遲暮 提交于 2019-12-04 12:29:53
I am developing an app using Codename One, which connects to a Bluetooth LE proprietary external device and logs received data (on average data arrives approximately once per second). I am using the Bluetooth LE CN1 library (a wrapper for Cordova Plugin ). The app should be able to receive and log the data even when not in foreground, which I have no idea how to do in CodenameOne in a way that the system wont shut it down on its own. I've written a native Android app, where I use a service with a persistent notification for the duration of the connection with the external BTLE device - the

How to get android background running process details

倖福魔咒の 提交于 2019-12-04 11:36:49
问题 I want to list all background running processes and get details of those from one background service(Without UI). Details are as follows: 1. Name 2. Memory usage 3. Application related to process 4. Files they are accessing 5. Last modified time of files I can get list of background running processes but how to get memory usage, Files they are accessing and Last modified time of files. Is this possible to implement at API level? Can anyone guide me How to do this? Can anybody give me idea or

Why do I get the information of “suspended (tty input)” when I run my script in the background

浪尽此生 提交于 2019-12-04 11:26:42
I've written a tcsh script to clear garbage data in a cluster, the code is : set hosts = $1 set clear_path = $2 foreach i ($hosts) rsh $i rm -rvf $clear_path end When I run this script in the background like this : disk_clean.sh hosts_all /u0/data/tmp > log & The job will get stuck and show the information like this: [1] + Suspended (tty input) If I run this in foreground, it can finish normally. Why does this happen? How can I run this script in the background and redirect the output into a log file? 来源: https://stackoverflow.com/questions/42361200/why-do-i-get-the-information-of-suspended

Detecting reboot programmatically in Windows Phone 8.1

╄→гoц情女王★ 提交于 2019-12-04 11:13:02
I have a WP 8.1 Runtime which launches a DeviceUseTrigger background task. The problem is that whenever the phone reboots, this task obviously cancels, but the task registration remains in place. So when I launch my app the next time the background task appears to be running when in reality it isn't. I want some way of detecting whenever the phone reboots and/or detect in some way whether or not the task is actually running or not. The code I'm using to check background task registration is as follows: foreach(IBackgroundTaskRegistration task in BackgroundTaskRegistration.AllTasks.Values) { if

Beep not working when phonegap app is in background on iOS

纵然是瞬间 提交于 2019-12-04 09:55:12
I’m working on the iOS version of my phonegap-based navigation app. My app tracks the user’s location around a walk route using GPS and alerts the user using audio (navigator.notification.beep) and tactile (navigator.notification.vibrate) feedback when they reach a location at which there’s new instructions for them to follow. When my app is running in the foreground, both the audible beep and the vibration fire on reaching the geographic location but when the app is paused in the background, either by pressing the power button to turn the screen off or pressing the home button to return to