New answers tagged

1

Options to prevent an application to run while VPN is running There are several options to prevent running an application when VPN is running: Combine the command to open VPN with the command to kill the application Run a small background script to kill the application if VPN runs Although the first option seems to be the cleanest, there are a few ...


1

Before: proc.Start() Add a handler method. For example: process.OutputDataReceived += (sender, a) => Console.WriteLine(a.Data); and replace this line: ret = proc.StandardOutput.ReadToEnd() with this: process.BeginOutputReadLine(); As an alternative you might also simply try adding only process.BeginOutputReadLine() after ret = ...


-1

Terminal: sudo nano /proc/sys/net/ipv4 ip_forward after change it, save with CTRL + O and exit with CTRL + X


3

Script to look up possible window(s) of given pid, then show, minimize or close it Since you mention the command line, the script below runs in a terminal window. You run it with the pid as an argument, e.g.: python3 /path/to/script.py 1234 Subsequently, a window (list) appears, of which you can choose a (list-) number and type an option to perform on ...


-2

After installing nginx my apache stopped working properly. Seems to in some cases apache confusing with nginx. Just remove nginx sudo apt-get purge nginx nginx-common sudo apt-get autoremove


2

Interesting question. As always, there are different ways to get a list of these applications, each of them with specific ad- and disadvantages. Getting a list of processes, represented in the Launcher, using the window list Since only applications with a (mapped) window appear in the Launcher, using: wmctrl -lp (wmctrl is not installed by default), ...


-1

Do ctrl + C that kills any command like cat Hope this helped you :)


0

Could you try giving the full path to forever when you start it for rc.local. Might be that the $PATH isn't set as it is you when you're logged in. Failing that, is there some log that forever produces? Can you tee to output where you run the command, like: /usr/local/bin/forever start <full path to>/server.js | tee /tmp/forever-start.log


2

From your comment, you stopped the process with Ctrl-z (which is not the same as terminating). If you want to kill the process, you have a few options Restore it to foreground and kill it. Use these commands: $ fg <kbd>Ctrl</kbd>-<kbd>c</kbd> Kill it while stopped. Just: $ kill % For completeness-sake (although not ...


5

If a computer starts misbehaving , use Magic Sysrq keys. Hold Alt+SYSRQ together, and press one by one R,E,I, S,U,B to reboot the system in a safe maner. If even that fails - powering off will be the last resort


1

There's no way to do that without modifying the program source. The problem is that X will buffer the events until after the program is resumed. You would need to handle the suspend (SIGTSTP) signal, record the current time according to the X11 server, then after resume read the events, and discard them based on the event time ...


0

ps has -o flag which has various options , which allow listing information about processes, among which is the stat option. For a running process you should have capital letters R or S shown (which may or may not have lower case letters). For example, here's what would be shown for a running opera browser. $ ps -e -o comm,stat | grep opera ...


4

The script #!/usr/bin/env python3 import subprocess import time import sys low = int(sys.argv[1]); high = int(sys.argv[2]); command = sys.argv[3:]; proc = command[0] def get_temps(): data = subprocess.check_output("sensors").decode("utf-8").splitlines() return sum([[float(l.split(":")[1].split()[0].replace("+", "").replace("°C", "")) \ for ...


-1

isProcessRunning() { if [ $(pidof $1) > /dev/null ]; then retval='true'; else retval='false'; fi; echo $retval; } isProcessRunning geany true


1

nohup does not disconnect a command from terminal, it makes your script ignore SIGHUP, and redirects stdout/stderr to a file nohup.out, so that the command can continue running in the background after you log out. nohup does not automatically put the command it runs in the background. One must do that explicitly, by ending the command line with an &. $ ...


4

This script will affect the whole process tree rooted at the process run in it. You can easily test it by running it in a terminal and checking the temperatures in another terminal using watch -n 1 'sensors -u | grep -Po "^ temp[0-9]+_input: \K.*"'. In this example the thresholds are set to 50 and 75 and the process run is stress -c 3: these are hard ...


4

This might work: #!/bin/bash targettemp=90 started=1 COMMAND & trap "kill COMMAND; exit" SIGINT SIGTERM while true do currenttemp=$(sensors -u | awk '/temp1_input/ {print $2; exit}' ) compare=$(echo $currenttemp'>'$targettemp | bc -l) if [ "$compare" -eq 1 ] && [ "$started" -eq 1 ] then started=0 kill -STOP COMMAND fi ...


1

It is not allowed to run pkexec in the background by fork and exec and then terminating the parent. The process becomes an orphan and belongs to init (ppid == 1). See: https://lists.ubuntu.com/archives/foundations-bugs/2012-July/100103.html You're giving control of an application to another user (usually root). The default way is to run the application with ...



Top 50 recent answers are included