brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ps -o lstart,etime shows when a process started and how long it ran

Troubleshooting
~/tips/tip-troubleshooting-ps-lstart-etime

ps -o pid,lstart,etime,cmd -p 1234

Check whether a service really restarted after your change or crashed recently.

You changed a config and restarted the service. Or did you? I trust the start time of the running process to settle it.

Ask for just those columns for one process ID:

ps -o pid,lstart,etime,cmd -p 1234

lstart is the full start date and time, and etime is the time elapsed since then. If the elapsed time is hours when you restarted a minute ago, you are still talking to the old process.

To check every process with a certain name, let pgrep supply the IDs:

ps -o pid,lstart,etime,cmd -p "$(pgrep -d, nginx)"

With a service that has workers, you may see an old master with fresh children. That usually means a reload happened and no full restart, which matters for settings that are only read at startup.

A very short elapsed time that keeps resetting is a different warning sign: something is crashing and being started again, and the logs are your next stop.

These columns come from the procps ps found on most distributions. Small images built on BusyBox, Alpine among them, may reject them. If pgrep finds nothing, the command fails with an error about the process list, which simply means nothing by that name is running.

Further reading: ps man page

More Troubleshooting tips Get-NetTCPConnection -State Listen modinfo -p usb_storage sudo lsof -nP -p 1234 fc-match Helvetica wp plugin list --status=active --field=name > active-plugins.txt All Troubleshooting tips (21) All topics

Link