Menu
  • HOME
  • TAGS

AIX Shell function to tail a log file for a specific string or for a specific time

bash,shell,aix

You can try tail -f -n0 "$yourfile" | grep -ql "yourstring" on my Linux, this works (almost) as expected. tail -f -n0 produces all lines that are added to the file, grep -ql quietly looks for a single match of "yourstring" in its input and exits afterwards....

how can i run 3 while loops simultaneously in unix and update the output of each loop to database as soon we get the output

unix,aix

You could put each loop in a function and then call these functions in background function loop1 {...} function loop2 {...} function loop3 {...} loop1 & loop2 & loop3 &

Install a fileset on AIX

aix,fileset

The reason why you are getting the error saying that you need the base level fileset, is because you are trying to install an update fileset. The .40 in the fileset version (bos.adt.syscalls.5.3.0.40) indicates that is an update, for you to be able to install that version of the fileset,...

Dependent module libdb2.a(shr.o) could not be loaded

php,apache,db2,ibm,aix

Can you paste the output of: dump -H /opt/freeware/lib/php/modules/ibm_db2_5.2.1.so You will see a lines like: INDEX PATH BASE MEMBER 0 /usr/lib:/lib:/usr/lpp/xlC/lib 1 ... The 0th entry is used to look for a file called libdb2.a with a member of shr.o. This is if LIBPATH is not set. If LIBPATH is...

Can't get JRuby to work on AIX machine

jruby,aix

OK, so the server admin and I spent two days trying to figure these things out and I can finally summarize the solution we ended up with to get JRuby working on AIX_64. 1 . First and most important of all, I had to install JRuby 1.7.9 since the 1.7.16...

g++ compilation error on AIX unix server

c++,g++,aix

The problem is that GCC's standard library defines std::ios::openmode as an enumeration type with overloaded operators, and in C++03 those operators are not allowed to appear in a constant expression (such as the initializer for an enumerator). It works with the Solaris compiler because (I assume) openmode is just an...

How to do file transfer inside ssh command line?

linux,shell,ssh,sftp,aix

if you're just copying a file up and then executing a script, and it can't happen as two separate commands you can do: gzip -c srcfile | ssh [email protected] 'gunzip -c >destfile; script.sh' This gzips srcfile, sends it through ssh to the remote end, gunzips it on that side, then...

No swap space detected while installing WLS 12c on AIX 7.1 (Installation Crashes)

installation,weblogic,swap,aix

I've never installed on AIX but you can try two things. First, run the installer with the -ignoreSysPrereqs option to skip over any memory checks. Second, run the installer "silently" to get more information out. Use the -silent option on the command line when you start the installer. You can...

Bash: assigning to a variable using another variable+text

bash,shell,aix

You can use declare directive here for declaring dynamic variables: declare ${filling}_pie="True" ...

Echo in AIX Shell behaves weird or any reason behind it

shell,echo,aix

This is because * gets expanded as all files in your current directory. You can avoid it with two ways: As you said, by quoting, which makes shell interpret it as a string and not a parameter: while read line do name=$line echo "$name" <---- echo within quotes done <...

Refresh directory Size in Linux

linux,aix

Have you checked lsof? If some application uses files they are not actually deleted till they close them. But I am not sure that this affects dir size.

Count number of special character combination of delimiters

awk,special-characters,aix,records

Using \\ instead of \ works for me. Not sure why exactly. Probably related to how escape characters are interpreted in bash, awk and awk's regex engine but I'm unable to give a good explanation. $ cat test name | ^surname| ^age | ^city | ^country john | ^doe |...

Why am I experiencing unexpected behavior with Linux signal handling?

linux,windows,unix,signals,aix

You must use sigsetjmp/siglongjmp to ensure the correct behavior when mixing signals and jumps. If you change your code it will correctly work under Linux. You also used the old signal API which not recommended. I encourage you to use the much more reliable sigaction interface. The first benefits will...

g++ Compilation in AIX server - Throwing core dump

c++,c,g++,aix

g++ -gxcoff -maix64 -shared -fpic ... Above command builds a shared library, not an executable that you can run. Remove -shared from it, as well as -Xlinker -e.main, and it should just work....

How can I use `sed` to replace the single quotes enclosing a directory with double quotes

regex,unix,sed,aix

This will do the job: /usr/bin/sed -e "/='.*\/.*'/ s/'/\"/g" file Basically, you just want the plain ' => " replacement, but not for all lines, just for those that match the pattern ='.*\/.*'/. And, in the s command you just need to escape the "....

MD5 Hash in AIX OS

unix,hash,md5,aix,string-hashing

csum -h MD5 It is in bos.rte starting in AIX 5.3...

error to delete files older than 1 day form csv list

sh,ksh,aix

recall that the form for a find command is find ${baseDir} -${options ......} args to opts. Your form is saying find tmp/$name -mtime +1 -type f # --^^^^^^^^^^ -- start looking in dir tmp/$name You probably want to say find tmp -name $name -mtime +1 -type f #---^^^^^ start looking...

Install of python module cryptography on AIX 5.3

python-2.7,aix

I got it installed with these changes: WARNING: This is a complete hack. Someone needs to figure out why this was successful and put in a real fix. /opt/freeware/lib/python2.7/config: # diff ld_so_aix.orig ld_so_aix 89c89 < impfile="./python.exp" --- > impfile="/opt/freeware/lib/python2.7/config/python.exp" 116a117 > impfile="/opt/freeware/lib/python2.7/config/python.exp" Note: the second setting of impfile is to...

Using mailx command not able to send email

shell,email,aix

After struggling for 2-3 hours i came to know that issue was due to some special characters in some mailx commands. I removed some of mailx line from script and rewrote them and ran the script.It is working fine now....

Make AIX load all shared symbols at run time?

c,reference,module,aix,dlopen

I found the culprit. I ran 'dump -Tv' on lib1.so and found that the function I expected to be exported was not there (although it did show up in nm, oddly enough). The library was linked with -bexpall so all symbols should be there. I dug deeper into the ld...

Shell Script: Generate Report Version

linux,shell,unix,aix

Use 2 variables. First variable will store the last execution date and the next one will store the version. Whenever you execute the script, first check if the date is same. If yes, increment the version else set the version to 1. Export the variables so that they retain their...

Using princexml tool from application server on AIX

java,web-applications,pdf-generation,aix,princexml

In case anyone is interested : We went with a java based tool called PDFreactor. It runs on JVM so meets our requirement to deploy on AIX. CSS support is comparable to PrinceXML tool....

getopt is not working on AIX as it does in Linux

linux,bash,aix,getopt

The basic issue is that getopt on AIX is not the getopt from linux. The one under linux supports long options, while the one on AIX doesn't. This is the same situation on Mac OSX. It can be solved by not using long options as part of the available options...

Can't make REDIS 2.8.19 on AIX 6.1 and GCC

gcc,redis,aix

I recently compiled Redis on AIX, and had to fix several build issues, but the end result works fine (so far) for our purposes. This is the script I came up with. Afterwards one test failed (which we can live with), see redis 2.8.19 on AIX: BRPOPLPUSH does not affect...

List files and timestamp of creation on AIX system (Perl)

perl,timestamp,aix

What you're looking for is @ARGV array, which you can use to loop over, and check $_ for current file name, perl -le 'print((stat $_)[9] . " $_") for @ARGV' foo.txt ...

“For loop” in AIX

loops,for-loop,find,aix

I would use a ksh shebang line (without space). Is MSS-Storage at the root level as suggested by the starting slash? You append the find results to tmp.txt, this file gets larger every run. I think you want to overwrite the file. You can redirect the find results skipping the...

Have whole script run, log any failures, but don't exit with a failure until the end in AIX

shell,unix,aix

Make a function for it that return the number of errors: check_conditions() { errors=0 if [ -d /foo ]; then echo "A is fine!" else echo "A is not fine" (( errors = errors + 1 )) fi if [ -d /bar ]; then echo "B is fine" else echo...

[: -eq: unary operator expected

bash,aix

Test string equality with =. #!/bin/bash export PROCNAME=test export TABLE_ID=0 if [ "${TABLE_ID}" = "" ]; then echo hello fi ...

Unable to copy using cp command in AIX

aix

Try to copy one of this files individually, to find out if the problem is file-specific. If so, check if the file-path containts something problematic, like a symlink to a not-readable directory. Also you can try 'truss' to find out the system-call that fails (open/read/write etc) -- not for beginners...

Is there a moment where a file “doesn't exist” during a rename?

perl,unix,rename,aix

The actual guarantee in POSIX is that if you rename a to b and b already exists, there will be no point in time during the rename when b does not exist. It will refer either to the previously existing b or the new b formerly called a. If b...

Ksh nested substitution

shell,unix,ksh,aix,substitution

ksh has the typeset -n command for this (see here), which I think would be the preferred solution: typeset -n tmp="PROFILE_SCSADP01" result=${tmp[${PROFILE_ACTIVE}]} You could also useeval (be careful) for this: tmp="PROFILE_SCSADP01" result=$(eval echo \${$tmp[${PROFILE_ACTIVE}]}) eval parses the command once before it is run, so after the eval completes, the resulting...

Wrong output of “ if [ -z $var ] ” in aix ksh

if-statement,ksh,aix

It doesn't work because the shell interprets it as if [ -z ]. To make it work, you need to quote it. This example is from AIX 7.1. $ echo $SHELL /usr/bin/ksh $ all="" Not quoted: $ if [ -z $all ]; then echo "empty"; else echo "not empty"; fi;...

Search Multiple directories and return one result

linux,search,aix

You could try the following command and then query the status code $?: find $FolderPath -name 'FileName.txt' | grep -E '*' This returns 1 when there are no files listed by the find command and 0 when there are. Optionally, if you're only interested in hitting a specific level to...

Unable to display xclock on aix

weblogic,aix,weblogic11g

Xclock started working fine after we reinstalled the X11 libraries. Thanks for eveyone's valuable inputs....

How to determine the subnet mask and network interface card from remote SSH login?

linux,shell,ssh,network-programming,aix

For Linux, I might do this something like so (using bash extensions, so invoked using a #!/bin/bash shebang, or piping the script over stdin to an interpreter invoked as ssh "$hostname" bash <<'EOF'): internet_address=8.8.8.8 # read data for the NIC used to route here dev_re='dev ([^[:space:]]+)($|[[:space:]])' read default_route < <(ip...

Search only directories with permission -find (Bash 4.2)

bash,find,aix,readable

Just use your find /home/ -name 'core.20*' -mtime +7 -print 2>/dev/null When you want to skip dir's without permission, your script must somehow ask Unix for permission. This is exactly what find is doing: when the toplevel is closed, no time is spent on the tree beneath. The only cost...

sed does not recognize -r flag on AIX

sed,aix

Unless you have a compelling reason to use sed, you could use alternate tools: awk -v OFS=';' '{print NR,$0}' filename would produce the desired output. You could also use perl: perl -ne 'print "$.;$_"' filename It appears that your sed expression would skip lines beginning with a #. As such,...

How can you determine how much disk space a DB2 table is using?

db2,aix

The simplest approach would be to query the ADMIN_GET_TAB_INFO table function: SELECT data_object_p_size + index_object_p_size + long_object_p_size + lob_object_p_size + xml_object_p_size FROM TABLE (SYSPROC.ADMIN_GET_TAB_INFO('YOURSCHEMA', 'YOURTABLE')) ...

Padding a files with n number of spaces at the end of the line

shell,unix,sh,padding,aix

Quote the variable line and better to use read -r: while read -r line; do printf "%-20s\n" "$line"; done < file1.txt Test: while read -r line; do printf "%-20s\n" "$line"; done < file1.txt | cat -vte Steve Smith $ Thomas Muller $ Tim Cook $ Bill Gates $ ...