Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by DoDDS-E_SM
at 2024-08-01 04:29:29
Point:500 Replies:16 POST_ID:828650USER_ID:11524
Topic:
Linux;Shell Scripting;Linux Programming
Could you please have a look at Ibtech’s problem?
Deamon spools its output to a file called chordiant/chroot/log/SPI_MAIN_CMDPROD.log –this works. Backup cron job cat /dev/nulls the file and after that deamon cannot write back to the same file. Why is that?
[chnadm@chprdapp01]:/chordiant/chroot/log>ls -rlt *MAIN*
-rw-r--r-- 1 chnadm chnadm 48 Jul 18 13:00 SPI_MAIN_CMDPROD.130718.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 19 13:00 SPI_MAIN_CMDPROD.130719.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 20 13:00 SPI_MAIN_CMDPROD.130720.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 21 13:00 SPI_MAIN_CMDPROD.130721.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 22 13:00 SPI_MAIN_CMDPROD.130722.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 23 13:00 SPI_MAIN_CMDPROD.130723.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 24 13:00 SPI_MAIN_CMDPROD.130724.log.gz
-rw-rw-rw- 1 chnadm chnadm 0 Jul 25 13:00 SPI_MAIN_CMDPROD.log
-rw-r--r-- 1 chnadm chnadm 48 Jul 25 13:00 SPI_MAIN_CMDPROD.130725.log.gz
[chnadm@chprdapp01]:/chordiant/chroot/log>crontab -l
#chordiant log cleaner
00 13 * * * /usr/local/fbUNIX/clean/chordiant_clean.sh >/dev/null
more /usr/local/fbUNIX/clean/chordiant_clean.sh
#!/bin/ksh
if [ -f /chordiant/chroot/log/AuditSystem.log ]
then
cp /chordiant/chroot/log/AuditSystem.log /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/AuditSystem.log
chmod 666 /chordiant/chroot/log/AuditSystem.log
chown chnadm.chnadm /chordiant/chroot/log/AuditSystem.log
gzip /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/SPI_MAIN_CMDPROD.log ]
then
cp /chordiant/chroot/log/SPI_MAIN_CMDPROD.log /chordiant/chroot/log/SPI_MAIN_CMDPROD.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/SPI_MAIN_CMDPROD.log
chmod 666 /chordiant/chroot/log/SPI_MAIN_CMDPROD.log
chown chnadm.chnadm /chordiant/chroot/log/SPI_MAIN_CMDPROD.log
gzip /chordiant/chroot/log/SPI_MAIN_CMDPROD.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/LockProcess.log ]
then
cp /chordiant/chroot/log/LockProcess.log /chordiant/chroot/log/LockProcess.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/LockProcess.log
chmod 666 /chordiant/chroot/log/LockProcess.log
chown chnadm.chnadm /chordiant/chroot/log/LockProcess.log
gzip /chordiant/chroot/log/LockProcess.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/JavaActivator.log ]
then
cp /chordiant/chroot/log/JavaActivator.log /chordiant/chroot/log/JavaActivator.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/JavaActivator.log
chmod 666 /chordiant/chroot/log/JavaActivator.log
chown chnadm.chnadm /chordiant/chroot/log/JavaActivator.log
gzip /chordiant/chroot/log/JavaActivator.$(date +%y%m%d).log
fi
Deamon spools its output to a file called chordiant/chroot/log/SPI_MAIN_CMDPROD.log –this works. Backup cron job cat /dev/nulls the file and after that deamon cannot write back to the same file. Why is that?
[chnadm@chprdapp01]:/chordiant/chroot/log>ls -rlt *MAIN*
-rw-r--r-- 1 chnadm chnadm 48 Jul 18 13:00 SPI_MAIN_CMDPROD.130718.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 19 13:00 SPI_MAIN_CMDPROD.130719.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 20 13:00 SPI_MAIN_CMDPROD.130720.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 21 13:00 SPI_MAIN_CMDPROD.130721.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 22 13:00 SPI_MAIN_CMDPROD.130722.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 23 13:00 SPI_MAIN_CMDPROD.130723.log.gz
-rw-r--r-- 1 chnadm chnadm 48 Jul 24 13:00 SPI_MAIN_CMDPROD.130724.log.gz
-rw-rw-rw- 1 chnadm chnadm 0 Jul 25 13:00 SPI_MAIN_CMDPROD.log
-rw-r--r-- 1 chnadm chnadm 48 Jul 25 13:00 SPI_MAIN_CMDPROD.130725.log.gz
[chnadm@chprdapp01]:/chordiant/chroot/log>crontab -l
#chordiant log cleaner
00 13 * * * /usr/local/fbUNIX/clean/chordiant_clean.sh >/dev/null
more /usr/local/fbUNIX/clean/chordiant_clean.sh
#!/bin/ksh
if [ -f /chordiant/chroot/log/AuditSystem.log ]
then
cp /chordiant/chroot/log/AuditSystem.log /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/AuditSystem.log
chmod 666 /chordiant/chroot/log/AuditSystem.log
chown chnadm.chnadm /chordiant/chroot/log/AuditSystem.log
gzip /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/SPI_MAIN_CMDPROD.log ]
then
cp /chordiant/chroot/log/SPI_MAIN_CMDPROD.log /chordiant/chroot/log/SPI_MAIN_CMDPROD.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/SPI_MAIN_CMDPROD.log
chmod 666 /chordiant/chroot/log/SPI_MAIN_CMDPROD.log
chown chnadm.chnadm /chordiant/chroot/log/SPI_MAIN_CMDPROD.log
gzip /chordiant/chroot/log/SPI_MAIN_CMDPROD.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/LockProcess.log ]
then
cp /chordiant/chroot/log/LockProcess.log /chordiant/chroot/log/LockProcess.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/LockProcess.log
chmod 666 /chordiant/chroot/log/LockProcess.log
chown chnadm.chnadm /chordiant/chroot/log/LockProcess.log
gzip /chordiant/chroot/log/LockProcess.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/JavaActivator.log ]
then
cp /chordiant/chroot/log/JavaActivator.log /chordiant/chroot/log/JavaActivator.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/JavaActivator.log
chmod 666 /chordiant/chroot/log/JavaActivator.log
chown chnadm.chnadm /chordiant/chroot/log/JavaActivator.log
gzip /chordiant/chroot/log/JavaActivator.$(date +%y%m%d).log
fi
Author: DoDDS-E_SM replied at 2024-08-14 04:37:12
Thanks but I need more time to test this out.
Author: DoDDS-E_SM replied at 2024-08-12 01:34:13
I am trying to check this out...the problem is that the developer is on vacation and will be back tomorrow. I am trying both suggestions. Thanks to you both gentlemen.
Assisted Solution
Expert: Anacreo replied at 2024-08-08 00:29:08
250 points EXCELLENT
Is it possible your chown syntax is simply wrong?
chown chnadm.chnadm /chordiant/chroot/log/AuditSystem.log
Shouldn't that be: (With a colon not a period between user/group)
chown chnadm:chnadm /chordiant/chroot/log/AuditSystem.log
Also you may want to do a fuser on the file and record that output...
fuser /chordiant/chroot/log/AuditSystem.log
on the file before starting to manipulate it?
chown chnadm.chnadm /chordiant/chroot/log/AuditSystem.log
Shouldn't that be: (With a colon not a period between user/group)
chown chnadm:chnadm /chordiant/chroot/log/AuditSystem.log
Also you may want to do a fuser on the file and record that output...
fuser /chordiant/chroot/log/AuditSystem.log
on the file before starting to manipulate it?
Author: DoDDS-E_SM replied at 2024-08-06 04:18:15
I am trying this out...I ll get back to you soonest.
Accepted Solution
Expert: carlmd replied at 2024-08-05 05:16:06
250 points EXCELLENT
Try inserting this line
cat /dev/null > /chordiant/chroot/log/AuditSystem.log
sleep 10 <------
chmod 666 /chordiant/chroot/log/AuditSystem.log
See if that makes any difference. It will suspend processing for 10 seconds, hopefully to allow the emptying of the log file to complete.
cat /dev/null > /chordiant/chroot/log/AuditSystem.log
sleep 10 <------
chmod 666 /chordiant/chroot/log/AuditSystem.log
See if that makes any difference. It will suspend processing for 10 seconds, hopefully to allow the emptying of the log file to complete.
Author: DoDDS-E_SM replied at 2024-08-05 04:24:12
there is no log...which drives me nuts...I suspect that the error comes from a syntax:
if [ -f /chordiant/chroot/log/AuditSystem.log ]
then
cp /chordiant/chroot/log/AuditSystem.log /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/AuditSystem.log ---- this is where I suspect I should change.
chmod 666 /chordiant/chroot/log/AuditSystem.log
chown chnadm.chnadm /chordiant/chroot/log/AuditSystem.log
gzip /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
fi
if [ -f /chordiant/chroot/log/AuditSystem.log ]
then
cp /chordiant/chroot/log/AuditSystem.log /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
cat /dev/null > /chordiant/chroot/log/AuditSystem.log ---- this is where I suspect I should change.
chmod 666 /chordiant/chroot/log/AuditSystem.log
chown chnadm.chnadm /chordiant/chroot/log/AuditSystem.log
gzip /chordiant/chroot/log/AuditSystem.$(date +%y%m%d).log
fi
Expert: carlmd replied at 2024-08-05 03:23:41
Since the log file is touched in serveral places in your script, at what line do you get the error?
Can you post the exact error.
Can you post the exact error.
Author: DoDDS-E_SM replied at 2024-08-02 12:26:57
cat /dev/null does it and your method also works...the problem is the application deamon which does not find the log file after its emptied out and does not write to it after it....therefore an application restart is necessary. I am trying to find a way for the deamon to find the file after is emptied out without also of course having to restart it so that it can log to the directory.
I was thinking about using touch. What are your thoughts?
I was thinking about using touch. What are your thoughts?
Expert: carlmd replied at 2024-08-01 07:16:33
Since the objective of cat /dev/null to the file is to clear it, then why not simply do
> filename
like > /chordiant/chroot/log/AuditSystem.log
instead.
This empties it out and will happen instantly.
> filename
like > /chordiant/chroot/log/AuditSystem.log
instead.
This empties it out and will happen instantly.
Author: DoDDS-E_SM replied at 2024-08-01 06:29:59
No other process uses the file. Only the deamon and cron when he backs it up
Expert: duncanb7 replied at 2024-08-01 05:58:02
deamon cannot write back to the same file
Is the "same file" related to backup process ?
if chordiant/chroot/log/SPI_MAIN_CMDPROD.log, the file is used for daemon only,
should be okay, how about other process is also using it ?
Author: DoDDS-E_SM replied at 2024-08-01 05:45:06
Also,do you have an idea on a workaround?
Author: DoDDS-E_SM replied at 2024-08-01 05:37:12
what will happen if they run on the same time?
Expert: duncanb7 replied at 2024-08-01 05:04:01
I mean deamon and backup cron-job could NOT do it within the same timeframe. I hope
I understood you question
I understood you question
Author: DoDDS-E_SM replied at 2024-08-01 04:59:28
I dont know what you mean. Could you please rephrase.
Expert: duncanb7 replied at 2024-08-01 04:50:56
Backup cron job cat /dev/nulls the file is not finsihed yet during backup process and holding the file
so you could not get the file permission for deamon
so you could not get the file permission for deamon