1753499 Members
4334 Online
108794 Solutions
New Discussion

syslog script nort run.

 
aamir4u
Regular Advisor

syslog script nort run.

Hi,

I want to copy earliar log messages daily.

but my script not run.

My script not run

Script:-vi .syslog.sh

cp /var/adm/syslog/syslog.log /tmp/oldsyslog

 

crontab setting:-

05 11 * * * /c03/.syslog.sh `date +%d%m%y`

 

 its not run why.

Help me.....

Thanks
aamir uddin
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: syslog script nort run.

What does /var/adm/cron/log say?

 

I am also confused as to why you have the `date...` line in  your cron job line.  What are you hoping to accomplish with it?

 

What are the permissions on the /c03/.syslog.sh script?

Dennis Handly
Acclaimed Contributor

Re: syslog script not run

>05 11 * * * /c03/.syslog.sh `date +%d%m%y`

 

You should replace this by:  ... $(date +\%d\%m\%y)

The backslashes are needed for each "%", see crontab(1).

 

>I am also confused as to why you have the `date` line in  your cron job line.

 

Perhaps .syslog.sh is a general script that needs to be able to run with arbitrary dates?  ;-)

Unfortunately the contents of the script doesn't use $1.

aamir4u
Regular Advisor

Re: syslog script not run

Hi,

There is no log on /var/adm/cron

and only default cron on that folder

 

 

billdev1#pwd

/var/adm/cron

billdev1#ls -lrt

total 3552 -r--r--r--   1 bin        bin             52 Feb 16  2007

.proto -r--r--r--   1 bin        bin             18 Feb 16  2007

at.allow -r--r--r--   1 bin        bin             14 Feb 16  2007

cron.allow -r--r--r--   1 bin        bin             17 Feb 16  2007

queuedefs prw-------   1 root       root             0 Jan  9 17:04

FIFO -rw-r--r--   1 root       root       1646656 Jan 10 15:35

OLDlog

billdev1#

billdev1# billdev1#ll

total 33800996 -rwxrwxrwx   1 root       sys             45 Jan  9 16:53 .syslog.sh (This is a permission)

 

My client told me.

make a script of logs than can copy all logs to any directory daily basis.

Please help me and give me any script.

Thanks
aamir uddin
aamir4u
Regular Advisor

Re: syslog script nort run.

Hi,

 

I am awaiting of your soonest response.

Thanks
aamir uddin
Dennis Handly
Acclaimed Contributor

Re: syslog script not run

>There is no log in /var/adm/cron

 

You probably need to stop and restart cron to recreate that file.

 

> -rw-r--r--   1 root       root       1646656 Jan 10 15:35 OLDlog

 

This looks like you just restarted cron(1m).

 

>-rwxrwxrwx   1 root   sys  .syslog.sh (This is a permission)

 

The permission should be 755 or 555 but not world writable.

 

>make a script that can copy all logs to any directory daily basis.

 

Have you looked at logrotate?