Skip to contentSkip to conversation

logrotate and auto start = no

PATCH New Wido den Hollander 2 participants 3 messages Feb 15, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

When "auto start = no" is set for the OSD's, the logs won't get rotated.

I've set this to no so I can easily reboot machines without all OSD's starting, I think it's easier with testing or when you replace a broken disk.

Anyway, this prevents the logs from being rotated, causing my disks to fill up:

/var/log/ceph/*.log {
    rotate 7
    daily
    compress
    sharedscripts
    postrotate
        invoke-rc.d ceph reload >/dev/null || service ceph reload 
Quoted 1 line

/dev/null

endscript
missingok
}

The init script doesn't touch daemons which have auto start set to no, but this also prevents logrotate from doing it's job.

Some suggestions:

1. Don't use the init script for logrotation
2. Modify the init script
3. Add a note in the documentation about this behaviour

I think that logrotation should work regardless the setting of auto start?

What do you think?

Wido

#1 lore raw
Quoted 21 lines · Wido den Hollander

Hi,

When "auto start = no" is set for the OSD's, the logs won't get rotated.

I've set this to no so I can easily reboot machines without all OSD's starting, I think it's easier with testing or when you replace a broken disk.

Anyway, this prevents the logs from being rotated, causing my disks to fill up:

/var/log/ceph/*.log {
    rotate 7
    daily
    compress
    sharedscripts
    postrotate
        invoke-rc.d ceph reload >/dev/null || service ceph reload >/dev/null
    endscript
    missingok
}
Quoted 7 lines

The init script doesn't touch daemons which have auto start set to no, but this also prevents logrotate from doing it's job.

Some suggestions:

1. Don't use the init script for logrotation
2. Modify the init script

This is my choice. We can probably just move the check into the 'start' block. It also looks like the auto_start check is doing something weird if the value is "mds"...

Quoted 3 lines

3. Add a note in the documentation about this behaviour

I think that logrotation should work regardless the setting of auto start?

Yeah, definitely!

sage

Quoted 10 lines

What do you think?

Wido
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/1 init: Only check if auto start is disabled when the issued command is "start"

This still makes sure daemons don't start on boot.

When auto start was disabled it would also prevent logrotate from doing it's job.

---
 src/init-ceph.in |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
src/init-ceph.in +7 -12
index 72249f9..2deed19 100644
@@ -171,13 +171,6 @@ for name in $what; do
     num=$id
     name="$type.$id"
 
-    get_conf auto_start "" "auto start"
-    if [ -z "$@" ] || [ "$@" = "mds" ]; then
-	if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
-	    continue
-	fi
-    fi
-
     check_host || continue
 
     get_conf pid_file "/var/run/ceph/$type.$id.pid" "pid file"
@@ -188,17 +181,19 @@ for name in $what; do
     [ -n "$log_dir" ] && do_cmd "mkdir -p $log_dir"
     [ -n "$log_sym_dir" ] && do_cmd "mkdir -p $log_sym_dir"
 
-    # start, and already running?  (do this check early to avoid unnecessary work!)
+    binary="$BINDIR/ceph-$type"
     if [ "$command" = "start" ]; then
+        get_conf auto_start "" "auto start"
+        if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
+            echo "Skipping Ceph $name on $host... auto start is disabled"
+            continue
+        fi
+
 	if daemon_is_running $name ceph-$type $id $pid_file; then
 	    echo "Starting Ceph $name on $host...already running"
 	    continue
 	fi
-    fi
 
-    # binary?
-    binary="$BINDIR/ceph-$type"
-    if [ "$command" = "start" ]; then
 	get_conf copy_executable_to "" "copy executable to"
 	if [ -n "$copy_executable_to" ]; then
 	    scp $binary "$host:$copy_executable_to"
Signature · 1 line
1.7.5.4