Warum wurde der Crontab-Job während des Laufens angehalten?

353
Prince Martin

Letztes Jahr kann es * Error.txt-Dateien generieren, und in diesem Jahr können unbegrenzt neue Switches in ein neues Projekt eingefügt und in einen neuen Sicherheitsmanager geändert werden. Was ist los am Syslog-Server?

Linux version 2.6.32-573.22.1.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Wed Mar 23 03:35:39 UTC 2016  [root@xcpalx03 emerg]# service --status-all | grep cron crond (pid 10487) is running... 

Der endgültige Dateiname, den es verarbeitet hat, ist -rw-r - r-- 1 root root 0 Jun 19 09:05 ErrorEX-DATA-3-mem0.log-20180619.gz.txt

Dann wurde es während des Laufens angehalten und kann die letzte Hälfte des Skripts nicht mehr ausführen

crontab job run with result [root@xcpalx03 emerg]# ls | wc 122 122 4585  standalone it can run and generate *Error.txt files [root@xcpalx03 emerg]# ls | wc 329 329 10680 

Standalone wurde wie folgt verarbeitet

./cps01fw01.log-20180619.gz ./EX-DATA-3-mem0.log-20180619.gz ./EX-DATA-4-mem0.log-20180619.gz ./EX-VOICE-1-mem0.log-20180619.gz ./EX-VOICE-2-mem0.log-20180619.gz ./Hot14ms01.log-20180619.gz ./KC-MX104-1-re0.log-20180619.gz ./localhost.log-20180619.gz ./MAPAPP01.log-20180619.gz ./new_c0101as01.log-20180619.gz ./new_c0103as05.log-20180619.gz 

mein Drehbuch

#!/bin/bash if [ -d "/root/emerg" ]; then echo "emerg folder exist" else mkdir /root/emerg fi yy=`date +%C%y` mm=`date +%m` dd=`date +%d` date1=$yy$mm$dd cd /root/emerg rm -f Error* || true rm -f *.txt || true rm -f *.html || true cd /var/log/remote for i in `(ls -l *$date1*;ls -l *.log) | grep -vE "cisco.log|cisco.txt" | /bin/awk '' | /usr/bin/uniq`; do echo ./"$" /usr/bin/zless ./"$" | /bin/grep -E "emerg:" > /root/emerg/Error"$".txt; done cd /root/emerg rm -f *Error.txt for i in `ls -l | /bin/awk '' | /bin/cut -c1-19 | /usr/bin/uniq`; do echo ./"$" /bin/cat ./"$"* > "$"Error.txt done 

/ var / log / cron log

Jun 19 09:13:01 xcpalx03 CROND[1522]: (root) CMD (cat /var/log/remote/*.log > /var/log/remote/cisco.txt) Jun 19 09:14:01 xcpalx03 CROND[1614]: (root) CMD (cat /var/log/remote/*.log > /var/log/remote/cisco.txt) Jun 19 09:15:01 xcpalx03 CROND[1651]: (root) CMD (/root/checkemerg.sh &) Jun 19 09:15:01 xcpalx03 CROND[1652]: (root) CMD (tac /var/log/remote/*.log > /var/www/html/cisco_log/cisco.txt) Jun 19 09:15:01 xcpalx03 CROND[1653]: (root) CMD (cat /var/log/remote/*.log > /var/log/remote/cisco.txt) Jun 19 09:16:01 xcpalx03 CROND[1711]: (root) CMD (cat /var/log/remote/*.log > /var/log/remote/cisco.txt) 

crontab config

[root@xcpalx03 emerg]# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/root  # For details see man 4 crontabs  # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 5 * * * * root /root/checklogemerg.sh & 50 * * * * root /root/checklog.sh & */15 * * * * root /root/checkemerg.sh & 10 * * * * root /root/checkdown.sh & 10 * * * * root /root/checkcrit.sh & 
0
Was ist der Grund, warum Sie die Befehle mit `&` unterstützen? Sie laufen bereits mit cron im Hintergrund. user38537 vor 5 Jahren 0
Ich fürchte, es ist Timeout, also laufe ich Hintergrund Prince Martin vor 5 Jahren 0
Egal ob oder nicht, es bleibt auf halbem Weg stehen Prince Martin vor 5 Jahren 0
Ich stelle fest, dass es nur 118 Dateien verarbeiten kann. Es gibt einige, in denen es begrenzt werden kann, oder wo es aufhört, wo ist es? Prince Martin vor 5 Jahren 0
Sind Sie sicher, dass die Jobs auf halbem Weg stehen oder könnten die Skripts vorzeitig ausfallen? user38537 vor 5 Jahren 0
Ich kann Standalone ohne Fehler ausführen. Ich habe das Gefühl, dass jemand Linux optimiert hat, um die Zeit oder die Anzahl der verarbeiteten Dateien zu begrenzen. Aber ich weiß nicht, wo gehackt wird. Sie können mein Skript sehen, das ein gutes Skript ist. Prince Martin vor 5 Jahren 0

0 Antworten auf die Frage