Scott Williams 🐧 on Nostr: Want to trigger some #bash action once a process is finished? Find the pid of the ...
Want to trigger some #bash action once a process is finished? Find the pid of the process with `ps` or `top` (1234 in this example) and then:
while ps 1234 ; do sleep 5 ; done ; git add . && git commit -m 'Updated dependencies.'
The commands after the `done;` will happen once the process finishes. Keep in mind that this will fire regardless of whether it finished successfully, but this is useful for triggering an action on an already long-running process.
#Linux #scripting
Published at
2025-03-05 18:45:31Event JSON
{
"id": "3433daff034ce41234e120ddb712767dd135618be04557407342e3d02ab31588",
"pubkey": "beee28c6450eb5d21bf94279d1f3f41e524c87abf86393835b45e6a1e98390e7",
"created_at": 1741200331,
"kind": 1,
"tags": [
[
"t",
"bash"
],
[
"t",
"linux"
],
[
"t",
"scripting"
],
[
"proxy",
"https://mastodon.online/users/vwbusguy/statuses/114111304918109993",
"activitypub"
]
],
"content": "Want to trigger some #bash action once a process is finished? Find the pid of the process with `ps` or `top` (1234 in this example) and then:\n\nwhile ps 1234 ; do sleep 5 ; done ; git add . \u0026\u0026 git commit -m 'Updated dependencies.'\n\nThe commands after the `done;` will happen once the process finishes. Keep in mind that this will fire regardless of whether it finished successfully, but this is useful for triggering an action on an already long-running process.\n\n#Linux #scripting",
"sig": "a4ab43ad9baa16754b92bfa05ac7c76dcd480e5009426bf8898aa12af82ac542e2e0de73ba95201a71f1618a19db0c9a8c034a707461e3fc87c749763fc2af15"
}