Skip to content

Instantly share code, notes, and snippets.

@guerbai
Created June 2, 2019 04:12
Show Gist options
  • Save guerbai/78ea70ace547dc8dfa1503343a635f14 to your computer and use it in GitHub Desktop.
Save guerbai/78ea70ace547dc8dfa1503343a635f14 to your computer and use it in GitHub Desktop.
shell判断一个应用未开启则开启
# 查放到.zshrc中
redis-server
result=`ps aux | grep 6379 | grep redis-server`
if [[ "$result" == "" ]]
then
redis-server &
fi
tomcat-server
result1=`ps aux | grep tomcat | grep /Library/Java/JavaVirtualMachines`
if [[ "$result1" == "" ]]
then
/usr/local/Cellar/tomcat/bin/startup.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment