I am using Linux platform (CentOS 7). sometimes i get my system just hang and then i need to do restart my system directly from power so anyone know how to rectify this issue without restart my system.I am fed up with every time restart my system. so please help me out.
I know here i will get my answer that's why i posted my question here.
Thanks in advance!!!
You can goto text mode and kill the process which process are running in your system,
Press CTRL+ALT+F2 and goto textmode.
Type your username and password
Write command ps -eaf|grep chrome (you can see here which process is
running and take that process number just like task manager in
windows)
Now need to kill that process so Write command kill -9 [process#]
once process will kill you can comeback again in graphics mode with
CTRL+ALT+F1
I hope this this answer will helpful for you beacuse this process is work fine for me when my any application stuck. :)
Related
I stuck in a problem, I want to shutdown the Linux PC using system command but my machine is asking to enter the password.
here is the scenario: I'm using 2 systems one is windows and another one is Linux. I'll send the command to Linux for shutdown, this Linux PC application made it as Service file, once I receive the command for shutdown, My Linux PC run the system function which is written like this system("shutdown -P now"); if I run this command my machine won't execute the command.
Kindly help me out in this!
Thanks & Regards
thank you Some programmer dude for your valuable feedback. Posting your suggestion as answer to help other community members.
The shutdown command needs super-user privileges. You can use some
additional commands to elevate the privileges along with the command
you are currently using.
I need to implement a program that will run on Windows CE 6.0, in C++, and that aims to kill a specific process at a specific moment.
I have tried to use 'TerminateProcess(ProcessHandle, ExitCode)'. It works, and kills the process whose handle I passed. However, when killing the specific process I want to kill, the machine stops responding, which is not acceptable.
I can kill the process via tellnet, if I use:
telnet 10.120.12.5 (IP of the Windows CE machine)
shell -d
kp 6522589 (example ID of the proccess)
That works. It kills the process and the machine does not stop running.
So the question is, how can I insert this command into my code? or, how can I call a script which does this from my code? (the script will have to be stored inside the windows CE machine).
Any other suggestion will be welcome.
How do you get the ProcessHandle? You usually need to free it with CloseHandle() after you are done with it (after calling TerminateProcess()).
You can use CreateProcess() to run another program, e.g. the shell/kp program.
This question sounds very stupid to me, but if this is somehow possible it would be really helpful.
My application is crashing and I need to debug it. And I run this application in another computer, via SSH (it's an HTTP server). If I could leave a terminal running the application over GDB and SSH all the time, I'd be able to find the bugs. But I don't have a free computer to do that. What can I do? Is there a way to start GDB with nohup(1) plus &> and stuff like that, so I can see GDB output (where command, for example) later?
A classical Unix program called screen is your friend (or its competitor tmux). It allows to keep a virtual console open across multiple logins:
screen
starts such a session; using you can detach from that; using
screen -r
you can reconnect to it later.
However, you don't even need that; just make your program leave a core dump when it crashes; ulimit -c unlimited says "every program that crashes leaves a core dump"; you can then just open the core dump using gdb later on, and everything will be as if you ran the program inside gdb when it crashed.
gdb core.123456
Windows has the SetThreadExecutionState method that enables you to prevent monitor standby during program execution.
I'm searching for a Linux equivalent, but I can't find anything useful.
I don't want to disable the screensaver by calling a command, because if the program crashes after that, the screensaver will stay disabled until the user re-enables it.
The program is written in Qt, so a Qt friendly solution would be great.
Ideas anyone?
I was looking for this and couldn't find a solution, but instead a workaround. Launching at the same time as the application (a video player) a little script to periodically check if the application process is alive, and if it isn't, re-enable the screensaver. In my case using xset s on and xset s off, then end the checker process itself. You can probably fork a process to the background so it stays alive and does its re-enable job reliably.
I'm pretty new to linux...
I was running an install script for something on my ubuntu vps and I got disconnected from the server. I'm able to log back in again but I'm worried this install script might be waiting for prompts in the background.
What's the best action to take in this situation? Should I just run the script again, or should I do some kind of cleanup first?
Thanks
When you disconnect (from the terminal), the install script receives a signal (SIGHUP) which usually leads to program termination. If it is stuck, you probably should kill and re-run it, but there is no 100% confidence it will work.
Next time use screen. If you disconnect, you can then reconnect to the running screen instance using screen -dr. It has many other features you can read about in the manual or numerous tutorials.