Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash only start a service if not running

#!/bin/bash
service=replace_me_with_a_valid_service

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: open new terminal window with applescript 
Shell :: dokcer not working 
Shell :: start confluence service ubuntu 
Shell :: linux ssh 
Shell :: npm instalk package from bitbucket 
Shell :: macbook disable input from built in keyboard 
Shell :: -windows run script on program close 
Shell :: terminal mkdir and cd 
Shell :: install Helm v3.x 
Shell :: linux find file 
Shell :: brew on windows 
Shell :: running kubernetes dasboard 
Shell :: git fast forward 
Shell :: how to generate ssh keys for git 
Shell :: zsh wait for user input 
Shell :: chmod using find in bash 
Shell :: create a new git branch 
Shell :: vscode keyring 
Shell :: how to remove pkg from mac 
Shell :: linux create file 
Shell :: como instalar pandoc en ubuntu 
Shell :: fork git ubuntu 
Shell :: upload file via terminal 
Shell :: Running a local script on a remote machine (or remote on local) 
Shell :: mac install glew 
Shell :: cut powershell 
Shell :: Start Apache service FreeBSD 
Shell :: git clone vs add remote 
Shell :: cli50 docs 
Shell :: enale scp in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =