Hello guys, today, I am going to portion ane of the useful tips to uncovering out how long a item procedure is running inwards Linux. This is really useful piece yous are troubleshooting an lawsuit together with desire to know whether your procedure or service is restarted fine on a daily or weekly basis. So yous checked your procedure is running inwards Linux operating organisation together with it's running fine, yesteryear using ps command. But straight off yous desire to know, from how long procedure is running, what is the kickoff engagement of that procedure etc. Unfortunately, PS command in Linux or whatsoever UNIX based operating organisation doesn't furnish that information.
But every bit said, UNIX or Linux has commands for almost everything together with if at that spot is no command, yous tin also banking concern fit around of import files inwards the /etc directory to uncovering out around useful info.
It’s been a long time, I convey posted whatsoever UNIX or Linux dominance tutorial, subsequently sharing around UNIX productivity tips. Hence, I am going to portion this prissy niggling tip, which yous tin hold out to banking concern fit how long a item procedure is running.
So I idea to portion this prissy niggling tip nearly finding runtime of a procedure inwards UNIX based systems similar Linux together with Solaris. In this UNIX dominance tutorial, we volition meet measurement yesteryear measurement guide to finding, since when a item procedure is running inwards a server.
But every bit said, UNIX or Linux has commands for almost everything together with if at that spot is no command, yous tin also banking concern fit around of import files inwards the /etc directory to uncovering out around useful info.
It’s been a long time, I convey posted whatsoever UNIX or Linux dominance tutorial, subsequently sharing around UNIX productivity tips. Hence, I am going to portion this prissy niggling tip, which yous tin hold out to banking concern fit how long a item procedure is running.
So I idea to portion this prissy niggling tip nearly finding runtime of a procedure inwards UNIX based systems similar Linux together with Solaris. In this UNIX dominance tutorial, we volition meet measurement yesteryear measurement guide to finding, since when a item procedure is running inwards a server.
Btw, if yous are novel into Linux or UNIX domain hence I also propose yous become through a comprehensive Linux class like Linux Command Line Basics on Udemy to larn around fundamentals together with essential commands of Linux. This volition aid yous to chop-chop acquire up-to-speed inwards Linux together with explore yourself.
I bought this class a twain of months agone together with fifty-fifty though I know most of the commands I establish it quite interesting for revision together with learned around useful options for uncovering together with grep which I didn't know earlier.
Linux Commands to uncovering Runtime of a Process
As I said, at that spot is no unmarried command, which tin nation us that from how long a procedure is running. We involve to combine multiple commands, together with our noesis of UNIX based systems to uncovering uptime of a process.
Step 1: Find procedure id yesteryear using ps dominance like
$ ps -ef | grep java
user 22031 22029 0 Jan 29 ? 24:53 coffee -Xms512M -Xmx512 Server
here 22031 is procedure id or PID. By the way, if at that spot are to a greater extent than than ane Java procedure running inwards your server than yous mightiness desire to hold out a to a greater extent than specific grep command to find PID.
Step 2: Find the Runtime or kickoff fourth dimension of a process
Once yous establish PID, yous tin expect into proc directory for that procedure together with banking concern fit creation date, that's the fourth dimension when your procedure was started.
By looking that timestamp yous tin easily uncovering from how long your procedure is running inwards Linux.
In gild to banking concern fit the timestamp of whatsoever procedure id procs directory, yous tin hold out next ls UNIX dominance alongside selection -ld every bit shown below :
Step 2: Find the Runtime or kickoff fourth dimension of a process
Once yous establish PID, yous tin expect into proc directory for that procedure together with banking concern fit creation date, that's the fourth dimension when your procedure was started.
By looking that timestamp yous tin easily uncovering from how long your procedure is running inwards Linux.
In gild to banking concern fit the timestamp of whatsoever procedure id procs directory, yous tin hold out next ls UNIX dominance alongside selection -ld every bit shown below :
$ ls -ld /proc/22031
dr-x--x--x 5 user group 832 January 22 13:09 /proc/22031
Here procedure alongside PID 22031 has been running from January 22, 13:09.
If yous are lucky, sometimes PS dominance also shows when a item plan has been started every bit shown inwards the next image:
That's all on How to uncovering uptime for a procedure inwards Java. Yes, it's similar to what uptime dominance render for a server, only yous tin hold out this to uncovering out how long a procedure has been running or when just it was started or rebooted. I actually similar these UNIX tips, every bit it's a neat tool to uncovering out how long a procedure is running inwards UNIX or Linux together with I convey used a twain of fourth dimension to banking concern fit if our spider web server is restarted or not.
Further Learning
Linux Command Line Basics
examples)
P. S. - If yous are looking for around gratis online courses to kickoff your Linux journey, yous should banking concern fit out my listing of Free Linux Courses for Programmers, information technology Professionals, together with System Administrators.