I have installed subversion using: 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?
You can query this information from the process table, using 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.