Sponsored Content
Top Forums UNIX for Advanced & Expert Users cron/logrotate chicken and egg problem Post 302236924 by jjinno on Tuesday 16th of September 2008 02:59:22 PM
Old 09-16-2008
The results are in...
I did a comparative strace between a fully functioning system and a system with cron failure. The basics are the same...

A poling loop for config changes (repeated every minute):
Code:
stat("cron", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/etc/cron.d", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/etc/crontab", {st_mode=S_IFREG|0644, st_size=255, ...}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {0x555555557772, [], SA_RESTORER|SA_RESTART, 0x2aaaaae0a460}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({60, 0}, {60, 0})             = 0

After some reads to /etc/localtime (for logging) and a message send, the first /var interaction... connecting to a socket:
Code:
[pid 24735] socket(PF_FILE, SOCK_STREAM, 0) = 3
[pid 24735] fcntl(3, F_GETFL)           = 0x2 (flags O_RDWR)
[pid 24735] fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
[pid 24735] connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
[pid 24735] close(3)                    = 0

Blah, blah, blah, some different libraries, a look at resolv.conf, and finally, the moment we have all been waiting for:
Code:
[pid 24735] socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
[pid 24735] connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.20.30.40")}, 28) = 0
[pid 24735] fcntl(3, F_GETFL)           = 0x2 (flags O_RDWR)
[pid 24735] fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
[pid 24735] poll([{fd=3, events=POLLOUT, revents=POLLOUT}], 1, 0) = 1
[pid 24735] sendto(3, "\377\276\1\0\0\1\0\0\0\0\0\0\7babylon5\7skynet\5loc"..., 39, MSG_NOSIGNAL, NULL, 0) = 39
[pid 24735] poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 5000) = 1
[pid 24735] ioctl(3, FIONREAD, [111])   = 0
[pid 24735] recvfrom(3, "\377\276\205\203\0\1\0\0\0\1\0\0\7babylon5\7skynet\5lo"..., 1024, 0, {sa_family=AF_INET, \
sin_port=htons(53), sin_addr=inet_addr("10.20.30.40")}, [16]) = 111
[pid 24735] writev(2, [{"crond", 5}, {": ", 2}, {"relocation error", 16}, {": ", 2}, {"/lib64/libresolv.so.2", 21}, {": ", 2}, \
{"symbol __res_iclose, version GLI"..., 97}, {"", 0}, {"", 0}, {"\n", 1}], 10 <unfinished ...>
[pid 24734] <... read resumed> "crond: relocation error: /lib64/"..., 4096) = 146
[pid 24735] <... writev resumed> )      = 146
[pid 24734] uname( <unfinished ...>
[pid 24735] exit_group(127)             = ?
Process 24735 detached

It does this once more, and then exits (on a Interrupted System Call) to resume the nanosleep loop...

Now, almost everything (except the error) is identical between the good and bad strace. The return code for the last recvfrom() is 91 on the good server, and 111 on the bad... also the sendto() returns 43 on the good server, and 39 on the bad...
 

8 More Discussions You Might Find Interesting

1. Red Hat

Problem seen with logrotate

Hi all, I have configured logrotate to logorotate every 12 hour. The configurations are as follows. /etc/cron.d/config ------------------------- SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO="" HOME=/root 0 */12 * * * root logrotate /etc/logrotate.d/test ... (1 Reply)
Discussion started by: rsravi74
1 Replies

2. UNIX for Advanced & Expert Users

logrotate with /etc/logrotate.conf file

Hi there, I want to rotate the logfiles which are located in /var/log/jboss/tomcat* so I have created a file named as 'tomat' in /etc/logrotate.d/tomcat with the following content. # cat /etc/logrotate.d/tomcat /var/log/jboss/tomcat_access_log*.log { daily nocreate ... (2 Replies)
Discussion started by: skmdu
2 Replies

3. UNIX for Advanced & Expert Users

Logrotate configuration problem

Hi, I have the following configuration file: /logs/system/mindundi/* { rotate 0 daily missingok sharedscripts postrotate find /logs/system/mindundi/ -name "*log" -mtime +15 -exec /bin/rm -f {} \; endscript } I want to save only... (6 Replies)
Discussion started by: mitchbcn
6 Replies

4. UNIX for Dummies Questions & Answers

logrotate and cron.daily/weekly

Hi guys, I've got two separate logrotates I'd like to run, one for Tomcat and one for Apache, but I'd like to run the Tomcat one daily and the Apache one weekly. Now, the logrotate itself is working fine, but although I have 'daily' in Tomcat, and 'weekly' in the Apache one, the latter is... (2 Replies)
Discussion started by: jimbob01
2 Replies

5. Shell Programming and Scripting

Logrotate - I am not able to rotate files using logrotate

I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest. I am using below command... (5 Replies)
Discussion started by: VSom007
5 Replies

6. AIX

Logrotate - /etc/logrotate.conf does't exist

Hi Admins. I have installed logrotate rpm on Aix 6.1. After the installation of rpm, I don't find /etc/logrotate.conf file and /etc/logrotate.d dir . The config file is located in /opt/freeware/etc/logrotate.conf. When I ran logrotate -v /opt/freeware/etc/logrotate.conf I get below... (2 Replies)
Discussion started by: snchaudhari2
2 Replies

7. Shell Programming and Scripting

Problem with logrotate

Hi, I have a problem with logrotate at Centos 7. My logrotate is configured with "rotate 0" to Apache logs, so it should never keep logs when rotating, just removing them and replacing by new empty ones at every rotation. But for some reason, once in a while, I see that logrotate is creating... (0 Replies)
Discussion started by: dado000
0 Replies

8. Shell Programming and Scripting

How to disable cron emails, but only for logrotate only not for other logs?

Guys, is there a script or command? how to disable cron emails, but only for logrotate only not for other logs (3 Replies)
Discussion started by: kenshinhimura
3 Replies
sched_getscheduler(3C)					   Standard C Library Functions 				    sched_getscheduler(3C)

NAME
sched_getscheduler - get scheduling policy SYNOPSIS
#include <sched.h> int sched_getscheduler(pid_t pid); DESCRIPTION
The sched_getscheduler() function returns the scheduling policy of the process specified by pid. If the value of pid is negative, the behavior of the sched_getscheduler() function is unspecified. The values that can be returned by sched_getscheduler() are defined in the header <sched.h> and described on the sched_setscheduler(3C) manual page. If a process specified by pid exists and if the calling process has permission, the scheduling policy will be returned for the process whose process ID is equal to pid. If pid is 0, the scheduling policy will be returned for the calling process. RETURN VALUES
Upon successful completion, the sched_getscheduler() function returns the scheduling policy of the specified process. If unsuccessful, the function returns -1 and sets errno to indicate the error. ERRORS
The sched_getscheduler() function will fail if: EPERM The requesting process does not have permission to determine the scheduling policy of the specified process. ESRCH No process can be found corresponding to that specified by pid. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
librt(3LIB), sched.h(3HEAD), sched_getparam(3C), sched_setparam(3C), sched_setscheduler(3C), attributes(5), standards(5) SunOS 5.11 1 Apr 2008 sched_getscheduler(3C)
All times are GMT -4. The time now is 06:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy