Pattern below allows for a bash script to be called via, say, cron and check to see if it is already running.
Useful for things like rsync
tasks.
PIDFILE=/var/run/myscriptname.pid
if [ -f $PIDFILE ]
then
PID=$(cat $PIDFILE)
Pattern below allows for a bash script to be called via, say, cron and check to see if it is already running.
Useful for things like rsync
tasks.
PIDFILE=/var/run/myscriptname.pid
if [ -f $PIDFILE ]
then
PID=$(cat $PIDFILE)
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
Picking the right architecture = Picking the right battles + Managing trade-offs