Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash check other instances

#!/bin/bash

BNAME=$(basename $0)
LOCKFILE=/var/lock/$BNAME
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
    echo "already running"
    exit
fi

# make sure the lockfile is removed when we exit and then claim it
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}

# do stuff
sleep 1000

rm -f ${LOCKFILE}
Comment

PREVIOUS NEXT
Code Example
Shell :: kali linuz 
Shell :: ahk get command line 
Shell :: how to show freeswitch registrations from fs_cli 
Shell :: qemu convert qcow2 to vdi 
Shell :: install veracrypt on mac 
Shell :: Git - Take a peek at a file of another branch 
Shell :: git find which files and folders are currently in the index 
Shell :: how to ùmake a file in console 
Shell :: what is bash os 
Shell :: tar exclude directories from a File 
Shell :: iis restart command promt 
Shell :: check space available ubuntu gui 
Shell :: using both ca cert and certificate between server and client 
Shell :: -bash: workon: command not found 
Shell :: Please install paramiko on your system. (sudo pip3 install paramiko) 
Shell :: hp probook 6560b hackintosh 
Shell :: how to kill your pc 
Shell :: bash similiar to choice in cmd 
Shell :: youtube dl text tracked playlist download 
Shell :: clone the dev masters of the package git 
Shell :: uaing awk to print columns from multiple files 
Shell :: GHDB categories 
Shell :: telegram cli install ubuntu 
Shell :: see processes from other terminals 
Shell :: how to upgrade sharepointpnppowershellonline 
Shell :: grafana grouped bar chart plugin 
Shell :: install pusher srever in larvel 
Shell :: protect chrome passwords with a password in ubuntu 
Shell :: debian 10 gcc compile 
Shell :: deepstream boost jetson nano clock 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =