Script in python to kill process by date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script in python to kill process by date
# 1  
Old 04-11-2012
Script in python to kill process by date

Hello everyone,
First sorry for my english.

I'm new in python and I want to create a script that allows the cleaning of a directory (/ tmp), files corresponds to a specific process according to the date.

Steps:

1 - I have to find all processes of a program running, eg OpenOffice, belonging to a User, by determining the date /start time of the oldest of them.

2 - Then delete all files (or directories) in "/ tmp" belonging to the the oldest Openoffice processes (the date determined in step 1)

I want to get ideas or functions to use for this script in linux (RedHat) and python 2.4

thank you Smilie

---------- Post updated at 04:46 PM ---------- Previous update was at 04:57 AM ----------

Help Smilie

Last edited by doudoubens; 04-11-2012 at 07:57 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture process id and kill that via script

Dear Experts , we have a script scheduled on daily basis , cd /u01/oracle/inst/apps/PROD_prodapps/admin/scripts/ ./adstpall.sh apps/apps echo " " echo " " echo " " ps -ef | grep FND pkill -9 FND ps -ef | grep FND pkill -9 FND ps -ef | grep FND but even then there are some... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

2. Shell Programming and Scripting

Kill all child process of a script

Hi guys i have a problem with a script... this script creates differents GUI with YAD... well i want that when i press the "Cancel" button on this graphical interface all the child process and even the same script should be killed #!/bin/bash function gui_start { local choice="" ... (4 Replies)
Discussion started by: maaaaarco
4 Replies

3. Shell Programming and Scripting

Python script help. Kill binary on timeout

This is part of my script, as you can see when the alarm is raised it shows some text, what I need it to do is to actually kill the binary "test" (TEST_PATH) when the timeout happens. #!/usr/bin/python26 from optparse import OptionParser import nagios import re import subprocess... (0 Replies)
Discussion started by: erick_tuk
0 Replies

4. Shell Programming and Scripting

kill process if timeout Python

I have a python script that calls a binary. I want to make sure that if the binary fails (with a 2 min timeout) it kills the process. Currently I'm unable to do that as I only kill the function but the binary is still running. Please help #!/usr/bin/python26 from optparse import OptionParser... (0 Replies)
Discussion started by: erick_tuk
0 Replies

5. Shell Programming and Scripting

Script to kill the specific process

Hi I have the process to kill regulary, but the PSID is dymatic change and not sure how to kill the specific process ID Check the tradekast_rvd is running , if such process, kill the els process id ps -e f |grep tradekast_rvd ps -ef |grep els then I kill els process id ... (2 Replies)
Discussion started by: linux_user
2 Replies

6. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

7. Shell Programming and Scripting

Script to Kill a Process by Name...

Hello all... new to these forums and a bit of a newbie with linux aswell. I need to figure out how to write a shell script to kill a process by name as given to the script as an argument. I've got that part working OK, but i need to make sure that the script does not allow processes that are... (6 Replies)
Discussion started by: cannon1707
6 Replies

8. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

9. Shell Programming and Scripting

Script to kill process...

hello Bros, I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running. I am using AIX 5.3 Thanks guys.:b: (2 Replies)
Discussion started by: malcomex999
2 Replies

10. Shell Programming and Scripting

Script to kill process

Hello guys, I have a process named monitoreo, with 'monitoreo start' my process start until i kill them, now i want to do 'monitoreo stop' to kill them. After 'monitoreo start' i have this process running: ps -af UID PID PPID C STIME TTY TIME CMD ati 10958 1495 ... (5 Replies)
Discussion started by: Lestat
5 Replies
Login or Register to Ask a Question
IRUNNER(1)																IRUNNER(1)

NAME
irunner - interactive runner interface SYNOPSIS
irunner [options] file_to_run DESCRIPTION
irunner is an interface to the various interactive runners available in IPython's irunner module. It can used to run scripts as if they where typed up interactively. The already implemented runners are listed below; adding one for a new program is a trivial task, see the source for examples. OPTIONS
-h, --help show this help message and exit --ipython IPython interactive runner (default). --python Python interactive runner. --sage SAGE interactive runner. EXAMPLE
irunner.py --python -- --help will pass --help to the python runner. Similarly, irunner.py --ipython -- --interact script.ipy SEE ALSO
ipython(1) AUTHOR
irunner is an extension of Ken Schutte <kschutte-AT-csail.mit.edu>'s script contributed on the ipython-user list: http://mail.scipy.org/pipermail/ipython-user/2006-May/003539.html This manual page was written by Bernd Zeimetz <bernd@bzed.de>, for the Debian project (but may be used by others). Modified by Fernando Perez <Fernando.Perez@berkeley.edu> for inclusion in IPython. July 15, 2011 IRUNNER(1)