I am trying to run the following Script on AIX Server. The script checks if first field is EFFECTIVE_TIME , if it is then it converts second field in readable format else it redirects entire line to $MAIL. Both the mentioned files exists prior to running the script
Code:
#!/bin/ksh
MAIL=~/backup_scripts/Changed_Policy_Details.txt
TMP=~/backup_scripts/List_of_Changed_Policies_tmp1.txt
while read line
do
read -a arr <<< $line
if [[ ${arr[0]} == EFFECTIVE_TIME ]];then
a=`perl -le "print scalar(localtime(${arr[1]}))"`
echo ${arr[0]} $a >> $MAIL
else
echo $line >> $MAIL
fi
done < $TMP
The $TMP and $MAIL File exists and the contents of $TMP are as follows :
Code:
Contents of /usr/openv/hpbackup/db/class/serverfgt/info :
ACTIVE 1
EFFECTIVE_TIME 1279345218
GRANULAR_RESTORE_INFO 0
Contents of /usr/openv/hpbackup/db/class/servertyg/schedule/Full/days :
0 13400 21000
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
Contents of /usr/openv/hpbackup/db/class/serverglt/info :
ACTIVE 0
EFFECTIVE_TIME 1279643561
GRANULAR_RESTORE_INFO 1
I am getting following error from AIX 5.3.
Code:
0403-057 Syntax error at line 4 : `<' is not expected
Could someone please help. I am not getting errors on Red Hat Server but problem only on AIX.
Please wrap all code, files, input & output/errors in CODE tags.
It makes them far easier to read and preserves multiple spaces for indentation and fixed width data.
Last edited by rbatte1; 11-05-2015 at 10:52 AM..
Reason: Added CODE & ICODE tags
According to your script you're interested only in the strings which begin with EFFECTIVE_TIME as the 1st word. In awk we have 2 statements - the first statement is for the strings, which have EFFECTIVE_TIME as the 1st word, and the second statement is for all other strings.
In the second case (easiest case) we just print the string itself. It is usually done with print $0.
In the first case we have to transform UNIX seconds to "normal" representation of the date. AIX standard awk doesn't have function to work with time/date as GNU awk, but ksh93 has.
So based on the input data we form a new script, which will be executed by ksh and transforms timestamp. If you run the one-line without | ksh93, you will see the script written with awk. Something like:
Hi
I'd like to ssh from an AIX OS server ( v5.3) to a Fabric OS server ( v6.1.2 ) without password.
I tried using dsa or rsa keys but it didn't work, the aix server still asked for the password.
Somebody help, please :(:(:( (8 Replies)
Hello,
I've set up email alerts on AIX Servers. so that i can get email notifications (via mail relay server) when ever there is abnormal behavior.
for example
1) my script monitors CPU/disk/memory etc... when it reaches high water ark, it will send an email alert.
2) disk usage alerts
3)... (5 Replies)
Hello people,
I'm facing some problems Installing AIX in my Power server 720
Well, to tell the truth my problem is in Virtual I/O (IVM) installation.
OBSERVE THAT I DON'T HAVE A HMC! By the way: I have the latest server Firmware!
I've done all the process in ASMI, then inserted and... (1 Reply)
I have a Perl script that worked fine before moving it to justhost.com. It was on a Windows/Apache server. Just host is using UNIX. Other Perl scripts on other sites that were also moved work fine so I know Perl is functioning.
The script is called cwrmail.pl and is located in my cgi-bin.
When I... (9 Replies)
Hi,
I'm trying to write a for loop to run through a list of servers and for each server copy a file to a backup file. But I can't seem to get it to run through my server list. It work for individual servers, please see below.
#!/bin/ksh
SSH_USERID=khcuser
webservers="server1 server2"
... (2 Replies)
i am new in AIX i am trying to write a script to take a backup for specific files on server to and check error log if backup success send email to administrator , script done except for sending mail , i try to configure sendmail on aix to use our exchange server to send emails but still get error... (0 Replies)
Hi,
I am a newbie to AIX. We have 2 AIX5.3 servers in our environment, I need to transfer some files in Binary mode from one server to another and some files in ASCII mode from one server to another server. Could you please help me as to how I need to do that?
Thanks,
Rakesh (4 Replies)
I have av script that loops through some statistic files to create a report. We would like to only loop through non-empty files as these files create an empty report-line.
I have figured out how to find the non-empty files, but not how to loop through only those files.
Here is the code that finds... (4 Replies)
Hi Friends
I am trying to install ssh in one of my AIX4.3 server.
I downloaded openssh and openssl from IBM site. While installing them openssh failed.
The lpcheck command display looks like this:
# lppchk -v
lppchk: The following filesets need to be installed or corrected to bring
... (5 Replies)
Hello,
I have a performance problem on an AIX box. I'm not sure what is causing this and hoping someone may have suggestions. Currently I'm noticing that cpu's are waiting while the box is in a idle state. I checked the disks and none of them are at 100%. If they were then I would understand... (3 Replies)