Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Check for hsqldb process is failling

I am developing a shell script that checks whether HSQL database is running or not on Ubuntu 20.04 platfrom. So I am attaching the script.
This script checks for the process with name HSQL. If the number of process including the ‘ps -ef’ command is 1 then there is no HSQL running. But while running the script it is always going to if block in all condition, not going to else block at all. Where am I going wrong? Could someone help?

Here is the script:

#!/bin/sh
export  noOfProcess=`ps -ef|grep hsqldb |wc| head -n1 | awk '{print $1;}'`
#echo ${noOfProcess}
 if [ ${noOfProcess}=1 ]
then
 echo 'database is not running'
 /home/priyatosh/test/hsqldb/hsqldb-2.5.0/hsqldb/runjsqldb.sh
else
  echo  'database is already running'
fi

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Please provide a space near equal to sign. So make it if [ ${noOfProcess} = 1 ]

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading