|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I'm writing my own service, it should run an app:
/usr/bin/socat PTY,link=/dev/ttyS0,raw,echo=0 tcp4:192.168.1.105:7000 And write it's PID to /var/run/socat1.pid. How can I check if my app is running with a given PID from file? I need this to restart my service on status check (if PID is dead). Thanks in advance! |
|
|||
|
If the pid is of running process there will be a directory at /proc/<pid>. You should double check that it is indeed the right process by looking at its command line, by reading cmdline, one of the "files" in that directory.
Better still, as hcvv said, use inittab to respawn the process when it exits. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|