Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Script to Copy Logs From Linux Client

Created: 26 Sep 2012 • Updated: 26 Sep 2012
Sachin_Joshi5's picture
0 0 Votes
Login to vote

This script can be used in jobs if task log are require to be copied at some central location & then looked at later.  

I have used %SERIALNUMBER% taken to uniquely identify client machines. User may opt to have additional tokens to make machine names unique.

Also user can modify it to capture specific logs.

Usage:

1. Create a Job that has 'prepare for Image capture' 'create image' & 'boot to production task'
2. Script task having code below can be sequenced after 'create image' task.
 

A folder will be created at shared location & log will be copied in that. Folder format is as below:

 %SERIALNUMBER%_ddMMMyyyy_hhmmss_taskstatus_taskname

##Script##

mkdir /mnt/shr
mount -t cifs //<IP>/Shared /mnt/shr -o username=<user>,password=<password>
test=`date "+_%d%b%Y_%H_%M_%S"`
test=`echo %SERIALNUMBER%$test`
test1=`aex-cta list | tail -n 2 | head -n 1 | awk '{print $3}'`
test2=`aex-cta list | tail -n 2 | head -n 1 | awk '{print $4}'`
pad='_'
test1=`echo $test1$pad$test2`
test=`echo $test$pad$test1`
mkdir /mnt/shr/Logs/$test
cp -r /opt/altiris/notification/nsagent/var/*log /mnt/shr/Logs/$test