I am writing a shell script to check if mongod server is running and if not, to start it. To acheive that I am using the below command:
systemctl is-active --quiet mongod
This does the job as expected. But it's possible my script will run on systems that do not have systemd, so I am interested in knowing whether there is a more portable way to do this.