我使用以下命令安装subversion : apt-get install subversion
我如何检测subversion是否从脚本运行,如果它已安装,我可以检测它,但我如何检查它的状态,然后对其执行操作?
发布于 2014-08-03 16:51:16
可使用ps(1)从工艺表中查询此信息。有许多方法可以确定具有特定名称的进程是否在进程表中。接下来的是一种方法。
#!/bin/sh
if [ -z "`ps -ef|awk '$8 ~ /[:print:]*svnserve/ { print $2 }'`" ]; then
# do things you should do when svn server daemon is not running
else
# do things you should do when svn server daemon is running
fi这是另一个。
if [ -z "`ps -ef|grep "[s]vnserve"`" ];then
# do things you should do when svn server daemon is not running
else
# do things you should ddo when svn server daemon is running
fihttps://stackoverflow.com/questions/25096549
复制相似问题