Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: [Update] denora.rc.in to support crontab operation  (Read 10386 times)

0 Members and 1 Guest are viewing this topic.

Alexander Maassen

  • Anope User
  • Offline Offline
  • Posts: 4
[Update] denora.rc.in to support crontab operation
« on: April 11, 2012, 04:44:21 PM »

diff --git a/src/bin/denorarc.in b/src/bin/denorarc.in
index 72c96b5..78215fd 100644
--- a/src/bin/denorarc.in
+++ b/src/bin/denorarc.in
@@ -108,6 +108,15 @@ elif [ "$1" = "rehash" ] ; then
        echo "Saving Databases and Rehashing Configuration"
        kill -1 `cat $DENORAPID`

+elif [ "$1" = "cron" ] ; then
+       if [ -f $DENORAPID ] ; then
+               PID=`cat $DENORAPID`
+               if [ `ps auxw | grep $DENOPROG | grep $PID | grep -v -c grep` = 1 ] ; then
+                       exit 1
+               fi
+       fi
+       $DENOPROG
+
 elif [ "$1" = "version" ] ; then
        $DENOPROG -version

@@ -125,6 +134,7 @@ elif [ "$1" = "help" ] ; then
                echo "$0 status         Show Denora's Status"
                echo "$0 restart        Restart Denora (Databases will be saved)"
                echo "$0 rehash         Rehash Configuration and Save Databases"
+               echo "$0 cron           Start denora if not running (usefull for crontab)"
                echo "$0 version        Return Denora Version and Build Information"
                echo "$0 help           Show this help menu"
                echo "If you need further help please check the /docs/"
@@ -134,5 +144,5 @@ elif [ "$1" = "help" ] ; then

 else
        echo "Denora Remote Control ($DRCVERSION)"
-       echo "Usage: $0 [start|stop|status|restart|rehash|version|help]"
+       echo "Usage: $0 [start|stop|status|restart|rehash|cron|version|help]"
 fi
Logged
Pages: [1]   Go Up