background-process

Is there any way to run service continuously in android?

∥☆過路亽.° 提交于 2019-11-27 09:10:36
There are few questions similar to this on StackOverFlow but none of the solutions are working for me Problem The problem is with only few devices like OnePlus and MI ,The service is getting killed as soon as the user swipes away app from recent app. I read that these OEM'S use some aggressive strategies to kill services . I just want to know is there any way to keep service running or start it as soon as it gets killed . What I want I need to run a service which will give location continuously (24/7) in background (This app is only for specific people so no worries about battery life) .

How do I kill a backgrounded/detached ssh session?

折月煮酒 提交于 2019-11-27 06:47:27
I am using the program synergy together with an ssh tunnel It works, i just have to open an console an type these two commands: ssh -f -N -L localhost:12345:otherHost:12345 otherUser@OtherHost synergyc localhost because im lazy i made an Bash-Script which is run with one mouseclick on an icon: #!/bin/bash ssh -f -N -L localhost:12345:otherHost:12345 otherUser@OtherHost synergyc localhost the Bash-Script above works as well, but now i also want to kill synergy and the ssh tunnel via one mouseclick, so i have to save the PIDs of synergy and ssh into file to kill them later: #!/bin/bash mkdir -p

python call external program non-blocking way

久未见 提交于 2019-11-27 06:19:07
问题 is there a way to call an external program inside python and don't wait for its execution to finish? I tried this, but no luck: os.system("external_program &") Normally, if I call external_program & inside a bash shell it executes as a background process. How can I do it inside python? For, my special case, creating another thread does not work. After main python scrip is done, the external program should continue its execution. 回答1: Yes, use the subprocess module. For example: p = subprocess

Need code example on how to run an Android service forever in the background even when device sleeping, like Whatsapp?

南楼画角 提交于 2019-11-27 06:16:46
I have tried various ways to achieve this, but my service eventually gets killed. I want to use AlarmManager to trigger a class every one hour. Even if the device is sleeping, it should sent a flashing LED alert, vibration or sound. In any case, it should run forever. I have noticed that Whatsapp is always running, even though I kill all the running apps and clear the memory, put the device to sleep, and still Whatsapp receive messages and alerts me. How are they doing it? I want to do the same with my app. zeeshan Since I posted this question, I have implemented two different approaches to

Run background process in Python and do NOT wait

拥有回忆 提交于 2019-11-27 04:53:17
My goal is simple: kick off rsync and DO NOT WAIT. Python 2.7.9 on Debian Sample code: rsync_cmd = "/usr/bin/rsync -a -e 'ssh -i /home/myuser/.ssh/id_rsa' {0}@{1}:'{2}' {3}".format(remote_user, remote_server, file1, file1) rsync_cmd2 = "/usr/bin/rsync -a -e 'ssh -i /home/myuser/.ssh/id_rsa' {0}@{1}:'{2}' {3} &".format(remote_user, remote_server, file1, file1) rsync_path = "/usr/bin/rsync" rsync_args = shlex.split("-a -e 'ssh -i /home/mysuser/.ssh/id_rsa' {0}@{1}:'{2}' {3}".format(remote_user, remote_server, file1, file1)) #subprocess.call(rsync_cmd, shell=True) # This isn't supposed to work

How to run a shell script in the background and get no output

99封情书 提交于 2019-11-27 04:09:06
问题 I wrote two shell scripts a.sh and b.sh . In a.sh and b.sh I have a infinite for loop and they print some output to the terminal. I want to write another script which calls both a.sh and b.sh but I want the user to regain control of the terminal immediately, instead of having the script run infinitely and I want to hide the output in terminal. 回答1: Use nohup if your background job takes a long time to finish or you just use SecureCRT or something like it login the server. Redirect the stdout

iOS: Keep application running in background

你。 提交于 2019-11-27 03:59:07
How do I keep my application running in the background? Would I have to jailbreak my iPhone to do this? I just need this app to check something from the internet every set interval and notify when needed, for my own use. user523234 Yes, no need to jailbreak. Check out the "Implementing long-running background tasks" section of this doc from Apple . From Apple's doc: Declaring Your App’s Supported Background Tasks Support for some types of background execution must be declared in advance by the app that uses them. An app declares support for a service using its Info.plist file. Add the

How to run a background job method at fixed intervals? [duplicate]

谁都会走 提交于 2019-11-27 03:35:02
问题 This question already has answers here : How to run a background task in a servlet based web application? (5 answers) Closed 4 years ago . I am using JSP/Servlet on Apache Tomcat. I have to run a method every 10 minutes. How can I achieve this? 回答1: As you're on Tomcat, which is just a barebones servletcontainer, you can't use EJB's @Schedule for this which is recommended by Java EE specification. Your best bet is then the ScheduledExecutorService from Java 1.5's java.util.concurrent package.

Run background services on battery saver mode Android

无人久伴 提交于 2019-11-27 03:28:53
问题 I have a service for sending http request that runs on background and works fine on "normal mode". The problem is when I put my phone on "battery saver mode", the service not working. But, apps like Whatsapp still working. Do you have any idea what's going on? 回答1: Mobile applications like Whatsapp must be requesting permission to exempt them from Doze/battery saving and App standby mode. It is possible to configure this manually by configuring the Whitelist in Settings > Battery > Battery

Powershell: Run multiple jobs in parralel and view streaming results from background jobs

强颜欢笑 提交于 2019-11-27 03:14:54
问题 Overview Looking to call a Powershell script that takes in an argument, runs each job in the background, and shows me the verbose output. Problem I am running into The script appears to run, but I want to verify this for sure by streaming the results of the background jobs as they are running. Code ###StartServerUpdates.ps1 Script### #get list of servers to update from text file and store in array $servers=get-content c:\serverstoupdate.txt #run all jobs, using multi-threading, in background