Main Menu

Search

Showing posts with label Linker Article UNIX GENERIC. Show all posts
Showing posts with label Linker Article UNIX GENERIC. Show all posts

LINUX: Take Backup of Files Using DateTimeStamps In Backup Filename (How To Doc)

Below is the command to take backup of file so that backup file has datetimestamps (Date / Timestamps) in name when the file was backed up.
cp -rp testfile.out testfile.out__$(date +%F'-'%T)

In above command example we are backing up testfile.out. Change this filename to the filename you want to backup. Below is example snippet which shows the backup file created with datetimestamps (highlighted in bold).

-rw-r--r-- 1 root root   0 Sep 28 14:39 testfile.out__2019-09-28-14:39:16
-rw-r--r-- 1 root root   0 Sep 28 14:39 testfile.out

Products to which Article Applies

All UNIX Operating Systems

LINUX: "find" Command To File Large Files Only in Local Root File Systems Excluding NFS Shares (How To Doc)

In Linux and UNIX Environments often times there may be need to clean up local filesystem space as it is full. In environment with NFS shares mounted it can get tricky to just identify the large files inside local file system. Below find command can be used to find the large files only in local file system.


find / -xdev -type f -size +500k -exec ls -lh {} \; | sort -n -r

Above command will search for all files inside only the local non NFS file systems which are over 50kb in size and then sort them by size and display.


Products to which Article Applies

All Linux and UNIX Environments.

LINUX: "find" Command To Find Large Files

In Linux and UNIX Environments often times there may be need to clean up filesystem space as it is full. So you will have to identify the files which are huge in size which needs to be checked and them cleaned. For finding the large files which in the file system below command can be used.


find /tmp -type f -size +50k -exec ls -lh {} \; | sort -n -r

Above command will search for all files inside /tmp which are over 50kb in size and then sort them by size and display.

You can change the /tmp to any directory where you want to search for the large files. In case you want to search inside all the directories / filesystems you can specify /. For e.g. as shown below.


find /-type f -size +50k -exec ls -lh {} \; | sort -n -r


Products to which Article Applies

All Linux and UNIX Environments.


LINUX: "ps" Command To Check The Complete Arguments Of Processes Like Java or Other Processes (How To Doc)

Usually Middleware applications or Application Server java process will have long startup arguments when the process startups. In some cases there may be need to check the complete arguments of java or other processes. For that scenarios below "ps" command can be used which will list the compute java process.


ps -auxww

Below is snippet of above command. As seen from below output we see complete startup arguments of the java process.


appuser    8928  5.2  3.6 5572052 1189192 ?     Sl   Feb15 1420:02 /app-share/java/bin/java -server -Xms512m -Xmx4096m -XX:MaxPermSize=512m -Dweblogic.Name=AdminServer -Djava.security.policy=/app-share/Middleware/wlserver_10.3/server/lib/weblogic.policy -Dweblogic.ProductionModeEnabled=true -Djava.awt.headless=true -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8453,server=y,suspend=n -da:org.apache.myfaces.trinidad -da -Dplatform.home=/app-share/Middleware/wlserver_10.3 -Dwls.home=/app-share/Middleware/wlserver_10.3/server -Dweblogic.home=/app-share/Middleware/wlserver_10.3/server -Dcommon.components.home=/app-share/Middleware/testapp_common -Djrf.version=11.1.1 -Ddomain.home=/app-share/ovm-manager-3/machine1/base_adf_domain -Djrockit.optfile=/app-share/Middleware/testapp_common/modules/testapp.jrf_11.1.1/jrocket_optfile.txt -Dtestapp.server.config.dir=/app-share/ovm-manager-3/machine1/base_adf_domain/config/fmwconfig/servers/AdminServer -Dtestapp.domain.config.dir=/app-share/ovm-manager-3/machine1/base_adf_domain/config/fmwconfig -Digf.arisidbeans.carmlloc=/app-share/ovm-manager-3/machine1/base_adf_domain/config/fmwconfig/carml -Digf.arisidstack.home=/app-share/ovm-manager-3/machine1/base_adf_domain/config/fmwconfig/arisidprovider -Dtestapp.security.jps.config=/app-share/ovm-manager-3/machine1/base_adf_domain/config/fmwconfig/jps-config.xml -Dtestapp.deployed.app.dir=/app-share/ovm-manager-3/machine1/base_adf_domain/servers/AdminServer/tmp/_WL_user -Dtestapp.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=/app-share/Middleware/testapp_common/modules/testapp.ossoiap_11.1.1,/app-share/Middleware/testapp_common/modules/testapp.oamprovider_11.1.1 -Djava.protocol.handler.pkgs=testapp.mds.net.protocol -Dweblogic.jdbc.remoteEnabled=false -Dweblogic.management.discover=true -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=/app-share/Middleware/patch_wls1035/profiles/default/sysext_manifest_classpath:/app-share/Middleware/patch_ocp360/profiles/default/sysext_manifest_classpath weblogic.Server
testapp    9192  0.0  0.1 8686200 53728 ?       Sl   Feb15  18:01 /app-share/java/bin/java -cp /app-share/ovm-manager-3/ovm_cli/classes:/app-share/ovm-manager-3/ovm_cli/lib/Model.jar:/app-share/ovm-manager-3/ovm_cli/lib/OvmClient.jar:/app-share/ovm-manager-3/ovm_cli/lib/slf4j-log4j12.jar:/app-share/ovm-manager-3/ovm_cli/lib/log4j.jar:/app-share/ovm-manager-3/ovm_cli/lib/org.apache.commons.logging.jar:/app-share/ovm-manager-3/ovm_cli/lib/sshd-core.jar:/app-share/ovm-manager-3/ovm_cli/lib/mina-core.jar:/app-share/ovm-manager-3/ovm_cli/lib/slf4j-api.jar -Dlog4j.configuration=file:./log4j.properties com.testapp.ovm.cli.CLIMain


Products to which Article Applies

All Linux and UNIX Environments.

LINUX: Command To Manually Mount NFSv3 Share On Linux Hosts (mount command)

Below is the command to manually mount NFS share on Linux hosts. In this example we are mounting NFSv3 share.

mount -t nfs -o vers=3 <Storage IP>:<ShareName> <Local NFS Share Name>

For e.g. if Storage IP is 10.10.10.10 and Share name is /export/testshare and your local directory which you are trying to mount as NFSv3 share is app-share, your mount command will look as follows:

mount -t nfs -o vers=3 10.10.10.10:/export/testshare/app-share

Products to which Article Applies

This Note applies to all Linux and UNIX hosts.


LINUX: Commands To Check For D State Processes On Linux Hosts (Troubleshooting Doc)

On Linux Hosts in some cases we will observe degraded performance due to D state process. D State Process means that the Process is Uninterruptable Sleep. 

Below commands will help to find the D State processes which are on the Linux Host.

ps -o pid,stat,cmd
ps -A -o pid,stat,cmd | grep 'D '
ps -A -o pid,stat,cmd
ps -elfy ww | grep ^D


Products to which Article Applies


All UNIX environments

Additional References


LINUX: Shell Script For Pinging Multiple IP Addresses / Hosts And Report Whether They Are UP or DOWN (How To Doc)

This article provides script which will ping multiple IP addresses / Hostnames and report if they are UP or down.

Below is the script content.

#!/bin/bash
# Program name: ping_multiple_ip_hosts.sh
echo "`date`" >>/tmp/result.out
cat /tmp/hosts |  while read output
do
    ping -c 1 "$output" > /dev/null
    if [ $? -eq 0 ]; then
    echo "node $output is up" >>/tmp/result.out
    else
    echo "node $output is down" >>/tmp/result.out
    fi
done


This script reads the IP addresses / hostnames from /tmp/hosts file. The IP addresses have to be light this in /tmp/hosts file with 1 IP or hostname per line.

10.10.10.10
10.10.10.20 

When the script is executed it redirects the output to /tmp/result.out file as follows. As you can see it prints date and whether the hosts are up or down.

Fri Aug 23 02:02:01 UTC 2019
node 10.10.10.10 is up
node 10.10.10.20 is up
Fri Aug 23 02:03:01 UTC 2019
node 10.10.10.10 is up
node 10.10.10.20 is up
Fri Aug 23 02:04:01 UTC 2019
node 10.10.10.10 is up
node 10.10.10.20 is up


Products to which Article Applies


All UNIX environments

Additional References