Viewing 1 to 9 of 9 items
Tag Archives: Pid

How to check how long a process ran after it finished?

Currently I’m using the following to check how long a process is actually running: ps -eo uid,pid,etime | egrep ‘^ *MY_ID’ | egrep ‘PID_OF_PROCESS’ And that outputs the following: MY_ID PID_OF_PROCESS 00:16 However, after the process ends I want to find out how long it actually ran for but I can’t seem to find that  Full Article…

0

How to check if process is running?

To me this script looks fine. Can somebody please assist me in finding what the problem is. Thank you Code: #!/bin/bash #———————————————————————————————————————- #This script allows the user to import a dsx file # # Usage: #./import.sh -s -d -r -f # #———————————————————————————————————————– dbname=”$dbname” dsn=”$dsn” dsxfile=”$dsxfile” rangechk=”$rangechk” verbose=”” reverb=”” module=`basename $0` DSXLOG_MODULE=$module export DSXLOG_MODULE dsxdir=”/var/local/dsx/import” dsximp=”/usr/local/bin/dsximp.exe”  Full Article…

0

Shell script to kill process Automatically after 3 days

I need script who automaticly will kill all (eggdrop,psybnc) processes on 3 days or 1 week #!/bin/bash # Days ago DAYS=”3″ PROCS=”eggdrop|psybnc” # Old date AGO=$(date –date=”$DAYS days ago” +”%b %d”) # Get pids PIDS=$(ps eaxo bsdstart,cmd,pid | egrep “^$AGO”‘ | egrep “$PROCS” | awk ‘{ print $4}’) # Now kill em echo “Killing $PROCS  Full Article…

0

Excluding grep from process list

ps aux | grep daemon_name | awk “{ print $2 }” grep’s -v switch reverses the result, excluding it from the queue. So make it like: ps aux | grep daemon_name | grep -v grep | awk “{ print $2 }” Upd. You can also use -C switch to specify command name like so: ps -C daemon_name -o pid=  Full Article…

0

lsof to find the process

lsof -t -i:4444 would list only the pid of the process listening on port 4444. You could just say kill `lsof -t -i:4444`   You use lsof: # lsof -n | grep TCP | grep LISTEN | grep 4444 The output will be something like: pname 16125 user 28u IPv6 4835296 TCP *:4444 (LISTEN) Where the  Full Article…

0