Quick-and-dirty way to ensure only one instance of a shell script is running at a time

Use flock(1) to make an exclusive scoped lock a on file descriptor. This way you can even synchronize different parts of the script. #!/bin/bash ( # Wait for lock on /var/lock/.myscript.exclusivelock (fd 200) for 10 seconds flock -x -w 10 200 || exit 1 # Do stuff ) 200>/var/lock/.myscript.exclusivelock This ensures that code between ( … Read more

Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes

<p:commandXxx process> <p:ajax process> <f:ajax execute> The process attribute is server side and can only affect UIComponents implementing EditableValueHolder (input fields) or ActionSource (command fields). The process attribute tells JSF, using a space-separated list of client IDs, which components exactly must be processed through the entire JSF lifecycle upon (partial) form submit. JSF will then … Read more

Wait until a process ends

I think you just want this: var process = Process.Start(…); process.WaitForExit(); See the MSDN page for the method. It also has an overload where you can specify the timeout, so you’re not potentially waiting forever.

The difference between fork(), vfork(), exec() and clone()

vfork() is an obsolete optimization. Before good memory management, fork() made a full copy of the parent’s memory, so it was pretty expensive. since in many cases a fork() was followed by exec(), which discards the current memory map and creates a new one, it was a needless expense. Nowadays, fork() doesn’t copy the memory; … Read more

How do I capture the output into a variable from an external process in PowerShell?

Note: The command in the question uses Start-Process, which prevents direct capturing of the target program’s output. Generally, do not use Start-Process to execute console applications synchronously – just invoke them directly, as in any shell. Doing so keeps the application connected to the calling console’s standard streams, allowing its output to be captured by … Read more

What resources are shared between threads?

You’re pretty much correct, but threads share all segments except the stack. Threads have independent call stacks, however the memory in other thread stacks is still accessible and in theory you could hold a pointer to memory in some other thread’s local stack frame (though you probably should find a better place to put that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)