Sponsored Content
Top Forums Shell Programming and Scripting Soft kill a process to redirect the last kbytes output to a file Post 302952542 by Corona688 on Wednesday 19th of August 2015 04:45:35 PM
Old 08-19-2015
Quote:
Originally Posted by Mastaer
thank you jim mcnamar,

but the problem is not the python script. it is ok to hard kill the python script.
It doesn't hurt the script or your system to hard-kill it, no -- but it certainly doesn't do what you want.

Python does single writes every 4096 bytes because this more efficient than doing 50 tinier writes. Python streams do this on the assumption the stream will end naturally, not get hard-killed while waiting for the 4096th byte. This is not a shell thing, a redirection thing, or any kind of system buffer -- the buffer is in Python, part of Python's code, controlled by Python, and must be configured in Python to disable Python's write buffer.

This is not the same as system disk cache, that's transparent, you'd see a correct result if the system knew it was supposed to be there.

This is not the same as the buffers used for pipes. Those don't apply when not using pipes.

You cannot force Python or any other program to not buffer from the outside, unless there's some mysterious NEVER_BUFFER environment variable Python responds to or something.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

how to kill process from file

hello i want to write a script in unix which read file that contains : hour and process_id like this file bbb: 0:30 6678 1:40 8789 and for every line he check if the hour greater then 30 minutes he kill the process_id the script looks like this cat bbb | while read line do ... (1 Reply)
Discussion started by: naamas03
1 Replies

2. Shell Programming and Scripting

how to kill process from file

i have a script that read a file which contains process_id and time that he's in and it lookes like this 0:30 54545 0:44 66788 0:90 23233 i need to read every line in the file and get the time and if the process is greater then 0:30 to kill the process id the script looks like... (17 Replies)
Discussion started by: naamas03
17 Replies

3. Programming

Redirect Output Multi-Process

Hi, I'm trying to compile the following code: /************** Begin <test.c> ***************/ /* * Compiled with: gcc -Wall -o test test.c */ #include <stdio.h> #include <unistd.h> int main(void) { printf("I'm process %d, son of %d \n", getpid(), getppid()); printf("Hello \n");... (3 Replies)
Discussion started by: djodjo
3 Replies

4. Shell Programming and Scripting

Redirect bg process output to within the script

Hi, I have a process running in the background, which throws up some output to the terminal when I run my script. How can I read this output from my script? Thank you. (5 Replies)
Discussion started by: Theju
5 Replies

5. Programming

Redirect Standard Output Multi-Process

Hi, I'm trying to compile the following code: /************** Begin <test.c> ***************/ /* * Compiled with: gcc -Wall -o test test.c */ #include <stdio.h> #include <unistd.h> int main(void) { printf("I'm process %d, son of %d \n", getpid(), getppid()); ... (5 Replies)
Discussion started by: djodjo
5 Replies

6. Shell Programming and Scripting

kill process from a file or directly with top

i have edited a script to kill an exact mysql process is causing the high load on the server, my problem is, kill dont kill it! script: #!/bin/sh top -n 1 -u mysql | grep mysqld | awk '{print $1}' > pid proc='cat pid' kill -9 $proc or i try with kill -9 `top -n 1 -u mysql | grep mysqld... (8 Replies)
Discussion started by: chandro
8 Replies

7. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

8. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

9. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

10. Shell Programming and Scripting

How to kill the process when the file is locked?

I was trying to read the file to create a table in SAS and I got error as follows while I read. Resource is write-locked by another user. File =/usr/sas/sas_config/Lev1/SASApp/StoredProcessServ​er/Logs/SASApp_STPServer_2015-09-29_tmp_18208.log. System Error Code = 0. ERROR: File is in... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies
SHEDSKIN(1)															       SHEDSKIN(1)

NAME
Shedskin - An experimental (restricted) Python-to-C++ Compiler SYNOPSIS
shedskin [OPTION]... FILE DESCRIPTION
Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python (2.4-2.6) programs into optimized C++. It can generate stand-alone programs or extension modules that can be imported and used in larger Python programs. Besides the typing restriction, programs cannot freely use the Python standard library (although about 25 common modules, such as random and re, are currently supported). Also, not all Python features, such as nested functions and variable numbers of arguments, are supported. OPTIONS
-a --ann Output annotated source code (.ss.py) -b --nobounds Disable bounds checking -e --extmod Generate extension module -f --flags Provide alternate Makefile flags -l --long Use long long integers -m --makefile Specify alternate Makefile name -n --silent Silent mode, only show warnings -o --noassert Disable assert statements -r --random Use fast random number generator (rand()) -s --strhash Use fast string hashing algorithm (murmur) -w --nowrap Disable wrap-around checking -x --traceback Print traceback for uncaught exceptions -L --lib Add a library directory 0.9.2 2012-05-05 SHEDSKIN(1)
All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy