commit ecb1e49bdaed9a58334f0112c09ccfc14726888a parent 48c8394c543639630e4943ca9f8f35d945795724 Author: Cem Keylan <cem@ckyln.com> Date: Tue, 17 Dec 2019 14:01:40 +0300 do not start sb if pid file exists Diffstat:
M | sb | | | 5 | ++++- |
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sb b/sb @@ -34,7 +34,10 @@ fi [ -z "$SLEEPTIME" ] && SLEEPTIME="1" for func in "$FUNCPATH/"* ; do . "$func"; done -[ -z "$nobar" ] && printf "$$\\n" > "/tmp/sb-$USER.pid" +if [ -z "$nobar" ]; then + [ -e "/tmp/sb-$USER.pid" ] && printf "ERROR: sb is already running\\nIf you think otherwise, remove /tmp/sb-$USER.pid manually.\\n" && exit 1 + printf "$$\\n" > "/tmp/sb-$USER.pid" +fi if ! command -V bar >/dev/null 2>&1; then bar() {