|
Newest Member
|
|---|
| beyondimagem | |
| cool Statistics |
| | coolcommands: | 1330 | | Categories: | 83 | | Total queries: | 595500 | | Members: | 16437 | |
|
|
|
 |
|
|
Category Search coolcommands.com
 |
Submitted by:
lvo   |
coolcommand
awk - oneliner to kill all current user specified processes if different from current time |
Description
This is a oneliner which greps for a process, ensures it is running by the person who runs this oneliner and then makes sure it is not running at the current time. If not, it does a kill on the process.
# ps -ef | grep "your_process" | grep `whoami` | grep -v grep | awk 'BEGIN {"date" | getline date ; split(date,d," "); t = d[4]} substr(t,1,7) != substr($5,1,7) {system ("kill " $2 )}'
If you want to get all old processes except your current one, try:
# ps -ef | grep `whoami` | grep -v grep | awk 'BEGIN {"date" | getline date ; split(date,d," "); t = d[4]} substr(t,1,7) != substr($5,1,7) {system ("kill " $2 )}'
|
Example
ps -ef | grep your_process | grep `whoami` | grep -v grep | awk 'BEGIN { {"date" | getline date ; split(date,d," "); t = d[4]} substr(t,1,7) != substr($5,1,7) {system ("kill " $2 )}' |
Return to search results
 |  |  |  |
Random coolcommands
coolcommand: unison - a file-synchronization tool for Unix and Windows
Example: unison dir1 dir2
[show me the details] |
coolcommand: unmirrorvg - how to unmirror a volume group in IBM AIX
Example: unmirrorvg workvg hdisk7
[show me the details] |
coolcommand: how to create a JFS2 filesystem with internal snapshots in AIX v5.3+
Example: crfs -v jfs2 "-dhomeslv" "-m/homes" "-Ayes" "-prw" "-a" "agblksize=4096" "-a" "logname=INLINE" "-a" "isnapshot=yes"
[show me the details] |
coolcommand: zcat - decompress a tar file
Example: zcat file.tar.Z | tar -xvf -
[show me the details] |
|
|
coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts
|  |  |  |  |
|
|
|
|
 |
|
|
|
Top 5 Submitters
|
|---|
| lvo | 1152 |
| audet | 37 |
| kah00na | 32 |
| Mariom | 24 |
| lebjf000 | 14 |
Top 5 Searches
|
| Category Solaris | 49379 |
| Category AIX | 46267 |
| Category General UNIX | 43933 |
| solaris | 22927 |
| aix | 22116 |
|
|
|
|