0% found this document useful (0 votes)
184 views

How To Define Crontab

This document discusses using cron jobs to automatically collect logs from RNCs daily. It provides an example cron job that runs a script at 6am every day to retrieve logs from multiple RNCs listed in a file. The script uses MOS commands to get various logs from each RNC and save them to directories organized by RNC name and IP address. It also explains how to create and list cron jobs.

Uploaded by

Mangata Acaronar
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
184 views

How To Define Crontab

This document discusses using cron jobs to automatically collect logs from RNCs daily. It provides an example cron job that runs a script at 6am every day to retrieve logs from multiple RNCs listed in a file. The script uses MOS commands to get various logs from each RNC and save them to directories organized by RNC name and IP address. It also explains how to create and list cron jobs.

Uploaded by

Mangata Acaronar
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Just share with you one function on OSS, it is Crontab, very useful for taking daily log .

Below is example to take Kget, alarm, cedh, and get xml alarm file form RNC to OSS server :

+ Create RNC list : 

user@gpcoss2> cat rnclist

HCRNC01                      10.210.0.148        rnc
HCRNC02                      10.210.15.148       rnc
HCRNC03                      10.210.64.148       rnc
HCRNC04                      10.210.96.148       rnc
DNRNC05                      10.204.101.148      rnc
HCRNC06                      10.204.108.148      rnc
HCRNC07                      10.204.109.148      rnc
BDRNC08                      10.204.102.148      rnc
HCRNC09                      10.204.110.148      rnc
HCRNC10                      10.204.111.148      rnc
CTRNC11                      10.204.103.148      rnc
AGRNC12                      10.204.104.148      rnc
CTRNC13                      10.204.105.148      rnc
KGRNC14                      10.204.106.148      rnc
CMRNC15                      10.204.107.148     rnc   

+ Create command file :

user@gpcoss2> cat kget.mos

$date1 = `date -u +20%y%m%d`


lt all
get 0 userLabel > $RNC
!mkdir /home/ericsson/RNC_Logfile/$RNC
!chmod 777 *
$password = rnc
get . nodeIpAddress > $ip_address
l+ /home/ericsson/RNC_Logfile/$RNC/ALT_STRT_$RNC__$ipaddress_$date1
alt
strt
l-
l+ /home/ericsson/RNC_Logfile/$RNC/KGET_$RNC_$ipaddress_$date1
kget all
l-
l+ /home/ericsson/RNC_Logfile/$RNC/CEDH_$RNC_$ipaddress_$date1
cedh
l-

user@gpcoss2> cat test.sh

/opt/ericsson/amos/moshell/mobatch -p 3 -t 30
/home/ericsson/RNC_Logfile/rnclist
/home/ericsson/RNC_Logfile/kget.mos /home/ericsson/RNC_Logfile/

+ Create crontab : use command crontab -e to create a cron job.

     + Press i to insert a new line


     + edit your crontab as below : 0 6 * * * /home/ericsson/RNC_Logfile/test.sh 
         which : 0             --> minute, value between 0 and 59
                 6             --> hour, value betwen 0 and 23
                first *      --> day of month ( 1 to 31 )
                 second * --> month ( 1 to 12 )
                 third *     --> day of week ( 0 to 6, 0 is Sunday )
                      /home/ericsson/RNC_Logfile/test.sh --> command , contain full path.

      + After finish, press  ESC to exit VI editor and press :wq to save your crontab.

To list all crontab , use command : crontab –l username :

user@gpcoss2> crontab -l ericsson


0 6 * * * /home/ericsson/RNC_Logfile/test.sh
55 20 * * * /home/ericsson/RNC_Logfile/alarmlog.sh

It means that, at 6 am every day OSS will do the test.sh script.

You might also like