简体   繁体   English

如何获取Linux状态的颠覆

[英]How To Get Subversion on Linux Status

I have installed subversion using: apt-get install subversion 我已经使用以下命令安装了Subversion:apt-get install subversion

How would I detect if subversion is running from a script, i can detect it if its installed but how would I check its status and then act upon it? 我如何检测脚本是否正在运行Subversion,如果安装了脚本,我可以检测到它,但是如何检查其状态然后采取行动呢?

You can query this information from the process table, using ps(1) . 您可以使用ps(1)从过程表中查询此信息。 There are many ways to find out if a process with a certain name is in the process table. 有多种方法可以查找过程表中是否存在具有特定名称的过程。 What follows is one way. 接下来是一种方法。

#!/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

And here is another. 这是另一个。

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
fi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM