onepatch.txt

patch for /usr/bin/one script - Bill Cole, 10/15/2013 06:01 PM

Download (1.72 KB)

 
1
--- /usr/bin/one.orig	2013-07-24 17:13:47.000000000 +0000
2
+++ /usr/bin/one	2013-10-15 17:42:34.058061555 +0000
3
@@ -22,6 +22,8 @@
4
     ONE_CONF=/etc/one/oned.conf
5
     ONE_DB=/var/lib/one/one.db
6
     ONE_LOG=/var/log/one/oned.log
7
+    ONE_SCHED_LOG=/var/log/one/sched.log
8
+    ONE_XMLRPC_LOG=/var/log/one/one_xmlrpc.log
9
 
10
     ONED=/usr/bin/oned
11
     ONE_SCHEDULER=/usr/bin/mm_sched
12
@@ -33,6 +35,8 @@
13
     ONE_CONF=$ONE_LOCATION/etc/oned.conf
14
     ONE_DB=$ONE_LOCATION/var/one.db
15
     ONE_LOG=$ONE_LOCATION/var/oned.log
16
+    ONE_SCHED_LOG=$ONE_LOCATION/var/sched.log
17
+    ONE_XMLRPC_LOG=$ONE_LOCATION/var/one_xmlrpc.log
18
 
19
     ONED=$ONE_LOCATION/bin/oned
20
     ONE_SCHEDULER=$ONE_LOCATION/bin/mm_sched
21
@@ -134,11 +138,6 @@
22
         fi
23
     fi
24
 
25
-    # Backup oned.log
26
-    if [ "$BACKUP" = "true" ];then
27
-        [ -f "$ONE_LOG" ] && cp $ONE_LOG{,.$(date '+%Y%m%d%H%M%S')}
28
-    fi
29
-
30
     # Start the one daemon
31
     start_oned
32
 
33
@@ -172,6 +171,10 @@
34
 
35
 start_oned()
36
 {
37
+    if [ "$BACKUP" = "true" ];then
38
+        [ -f "$ONE_LOG" ] && mv $ONE_LOG{,.$(date '+%Y%m%d%H%M%S')}
39
+        [ -f "$ONE_XMLRPC_LOG" ] && mv $ONE_XMLRPC_LOG{,.$(date '+%Y%m%d%H%M%S')}
40
+    fi
41
     $ONED -f 2>&1 &
42
 
43
     LASTRC=$?
44
@@ -187,6 +190,9 @@
45
 
46
 start_sched()
47
 {
48
+    if [ "$BACKUP" = "true" ];then
49
+        [ -f "$ONE_SCHED_LOG" ] && mv $ONE_SCHED_LOG{,.$(date '+%Y%m%d%H%M%S')}
50
+    fi
51
     $ONE_SCHEDULER&
52
 
53
     LASTRC=$?
54
@@ -229,9 +235,9 @@
55
         start_sched
56
         ;;
57
     *)
58
-        echo "Usage: one [-f] {start|stop}" >&2
59
+        echo "Usage: one [-f] {start|stop|start-sched|stop-sched|restart-sched}" >&2
60
         echo "Options:" >&2
61
-        echo "  -f  Do not backup log file." >&2
62
+        echo "  -f  Do not backup log files." >&2
63
         exit 3
64
         ;;
65
 esac