Tag Archives: STATUS

Assistiance in small bash script

By Aviel.shani

Hi All,
i wrote an simple script, that will monitor some services ,and if particular service will found down ,the code will restarts the service and message about the process will be sent on mail.

I have a problem somewhere in the syntax that the script initializes the service even if is up ..

Your help please, what should I fix the code :

#!/bin/bash
# Simple script that uses systemctl to check if a service is
# running. If its not it is restarted and an email is sent to
# the configured mailbox.
SERVICE=/etc/init.d/xinetd
MAILBOX=*********
STATUS=”/etc/init.d/xinetd status”
if [ “$SERVICE status” != ‘xinetd is stopped’ ]
then
/etc/init.d/xinetd restart
$STATUS | mail -s “the xinet.d service getting restart” $MAILBOX
fi
exit 0

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

FTP Status check(whether it is suuccessful or not)

By Kannannair

Hi Friends

I need to check the status of FTP connection i.e. Whether it is successful or not

I have tried this by assigning the FTP connection script to a variable and after that using this variable I tried to check the status.

In the below code snippet I am trying to assign the FTP conenction status to a variable.

Code:


STATUS=`ftp -n $HOST <<EOF
quote USER $USER
quote PASS $PASSWD
prompt off
cd /user/sba-appl/test/sscr/ramu/
lcd /user/sba-appl/productie/sscr/darshan
mget get.DAT
bye
EOF`


Can anyone tell whether this approach is correct or not. When i am trying this method FTP connection is not happening. Whether we can assign the FTP connection like this

Because after this i can use the above variable and check the status for various FTP states like 226 553etc using the grep command.

Thanks and Regards
Darshan

From: http://www.unix.com/shell-programming-scripting/221797-ftp-status-check-whether-suuccessful-not.html

FTP Status check(whether it is successful or not)

By Kannannair

Hi Friends

I need to check the status of FTP connection i.e. Whether it is successful or not

I have tried this by assigning the FTP connection script to a variable and after that using this variable I tried to check the status.

In the below code snippet I am trying to assign the FTP conenction status to a variable.

Code:


STATUS=`ftp -n $HOST <<EOF
quote USER $USER
quote PASS $PASSWD
prompt off
cd /user/sba-appl/test/sscr/ramu/
lcd /user/sba-appl/productie/sscr/darshan
mget get.DAT
bye
EOF`


Can anyone tell whether this approach is correct or not. When i am trying this method FTP connection is not happening. Whether we can assign the FTP connection like this

Because after this i can use the above variable and check the status for various FTP states like 226 553etc using the grep command.

Thanks and Regards
Darshan

From: http://www.unix.com/shell-programming-scripting/221797-ftp-status-check-whether-successful-not.html

vnc version question

By bitlord

Hello,
Help me understand this. I’m on a Solaris 10 server with VNC installed on it. VNC comes installed by default on Solaris 10. I ‘m tiring to see if the system has the latest version of VNC installed.
The package for VNC on Solaris is SUNWxvnc

Code:

pkginfo -l SUNWxvnc
PKGINST: SUNWxvnc
NAME: X11/VNC server
CATEGORY: system
ARCH: sparc
VERSION: 6.6.2.0500,REV=0.2008.02.15
BASEDIR: /usr
VENDOR: Sun Microsystems, Inc.
DESC: X Window System server based on X.Org Foundation open source release and RealVNC open source release that displays over RFB protocol to a VNC client
PSTAMP: x10s20080515125558
INSTDATE: Nov 02 2012 08:50
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 22 installed pathnames
7 shared pathnames
11 directories
4 executables
1 setuid/setgid executables
8838 blocks used (approx)


On the real VNC site it shows that vnc there latest version of VNC for Solaris is 5.0.5. So basicly how do figure out what version I have?

From: http://www.unix.com/solaris/221423-vnc-version-question.html

Need help for Curl package

By manalisharmabe

Hi all,

I need the same curl package installed on system1 to be installed on other system2. Both machines are Solaris 10

System1:

Code:

-bash-3.00$ pkginfo | grep curl
system SFWcurl curl - tool for transfering data specified with URL syntax


Code:

-bash-3.00$ pkginfo -l SFWcurl
PKGINST: SFWcurl
NAME: curl - tool for transfering data specified with URL syntax
CATEGORY: system
ARCH: sparc
VERSION: 7.19.5,REV=2009.08.23.06.12
BASEDIR: /opt
VENDOR: curl and libcurl
DESC: curl - tool for transfering data specified with URL syntax
PSTAMP: freeware20090825021108
INSTDATE: Mar 15 2010 11:05
HOTLINE: Please contact the owners of this software
STATUS: completely installed
FILES: 75 installed pathnames
8 directories
3 executables
2537 blocks used (approx)
-bash-3.00$


system2:

Code:

-bash-3.2$ pkginfo | grep curl
application SMCcurl curl
-bash-3.2$


Code:

-bash-3.2$ pkginfo -l SMCcurl
PKGINST: SMCcurl
NAME: curl
CATEGORY: application
ARCH: sparc
VERSION: 7.19.7
BASEDIR: /usr/local
VENDOR: The Curl Group
PSTAMP: Steve Christensen
INSTDATE: Apr 10 2013 18:08
EMAIL: steve@smc.vnet.net
STATUS: completely installed
FILES: 335 installed pathnames
9 shared pathnames
14 directories
4 executables

Source: FULL ARTICLE at The UNIX and Linux Forums

Python script called by a shell script

By q8devilish

experts, i wrote a python script to do a certain job, i tried it and it is working fine, i want this script to be executed automatically after a ksh script, the problem is when i execute the ksh script my python script runes perfectly after the ksh script as I have include it at the end of the ksh script with the full path which is the same directory I am running the script from, but when a user run it from an oracle forms i got an error msg says

Code:

No such file or directory


I notice that the KSH script is executing a .profile file, i have include that too, i need an expert to tell me how can i execute my python inside the this ksh script.

this is the KSH script

Code:

#! /usr/bin/ksh
. $POWERCARD_HOME/.pcard_profile
#/pcard16/pwrcard/.pcard_profile

echo "================" >> $TRACE/card_production_batch.stat
echo "START PROCESSING" >> $TRACE/card_production_batch.stat
date_id=`date +%y%m%d%H%M`
echo $date_id >> $TRACE/card_production_batch.stat

card_production card_production $1 C 1>$TRACE/card_production_batch.stat 2>&1

export r=$?

## IOManager
#export TASK_NAME=card_production

#if [$proc_status -eq 1 ] 1>>/dev/null 2>&1
#then
# STATUS=OK
#else
# STATUS=KO
#fi
#export STATUS

#.iomanager1.sh
## IOManager
d=`date +%y%m%d%H%M`

echo $date_id >> $TRACE/card_production_batch.stat
echo "END PROCESSING" >> $TRACE/card_production_batch.stat
echo "================" >> $TRACE/card_production_batch.stat

#echo $(date) >> /pcard16/pwrcard/usr/shl/mahdi_test

./embosingExtraction.py 2>>/pcard16/pwrcard/usr/shl/embose_debug.txt
#.$SHL/embosingExtraction.py 2>>/pcard16/pwrcard/usr/shl/embose_debug.txt
echo '---------------------------------------------' >>/pcard16/pwrcard/usr/shl/embose_debug.txt
#echo $(date) >> mahdi_test

exit $r


embosingExtraction.py is my python script i have placed it in the same directory of the KSH script. Here is a look at .pcard_profile that executed in the first line of the KSH script

Code:

#! /usr/bin/ksh
#######################################################
### Include Environnement Variables ##
#######################################################
export HOME=/pcard16/pwrcard
export POWERCARD_HOME=$HOME
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10g
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export ORACLE_SID=pcard
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export ORACLE_LIB=$ORACLE_HOME/lib:/usr/lib:/lib
export TRACE=/pcard17/trace
export ARCHIVE=$HOME/usr/archive
export QUEUE=$HOME/usr/queue
export EXPORT=$HOME/usr/export
export BIN=$HOME/usr/bin
export SHL=$HOME/usr/shl
export CTL=$HOME/usr/ctl
export PATH=$PATH:$BIN:$SHL
export PATH=$PATH:$BIN:$SHL
export DATA=$HOME/usr/data
export DB_MODE=0
export DB_USER_PROD="xxxxxxxxxx"
export DB_USER_TEST="xxxxxxxxxx"
export DB_PASSWORD_PROD="xxxxxxxxxxxxxxxxxx"
export DB_PASSWORD_TEST="xxxxxxxxxxxxxxxxxx"
export EXP_USER=xxxxxxxx/xxxxxxxxx
#mahdi_addition:
export PATH=$PATH:/pcard16/pwrcard/usr/shl
export POWERCARD_TRACE=/pcard17/trace
#######################################################
export HOME_ENV_MAKEFILE=$HOME/src/libs
export PLATFORM="SOLARIS"
#export CC="fcc -KV9"
export LLIBSOCKETS=-lsocket
#######################################################
### User compilation
#######################################################
export usercomp=xxxxxxxxxxx
export passwcomp=xxxxxxxxxx
export DEBUG_MODE="0"


…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Version of OpenSSL being used

By CHoggarth

Hello

I’m relatively new to technologies like Apache & ssl but have some years
experience with Unix. My question concerns the version of OpenSSL which is
genuinely being used on our server & how is that set.

The server is running Solaris 10. I’ll show output from various commands:

Code:

:/usr/local/ssl # pkginfo -l SMCossl
PKGINST: SMCossl
NAME: openssl
CATEGORY: application
ARCH: sparc
VERSION: 1.0.1c
BASEDIR: /usr/local
VENDOR: The OpenSSL Group
PSTAMP: Steve Christensen
INSTDATE: Aug 17 2012 07:27
EMAIL: steve@smc.vnet.net
STATUS: completely installed
FILES: 1871 installed pathnames
1 shared pathnames
43 directories
32 executables
30745 blocks used (approx)

:/usr/local/ssl #


Code:

:/usr/local/ssl # openssl version -a
OpenSSL 1.0.1c 10 May 2012
built on: Sun May 13 18:44:13 EDT 2012
platform: solaris-sparcv9-gcc
options: bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) idea(int) blowfish(ptr)
compiler: gcc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -
DDSO_DLFCN -DHAVE_DLFCN_H -m32 -mcpu=ultrasparc -O3 -fomit-frame-
pointer -Wall -DB_ENDIAN -DBN_DIV2W -DOPENSSL_BN_ASM_MONT -DSHA1
_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DGHASH_ASM
OPENSSLDIR: "/usr/local/ssl"
:/usr/local/ssl #


But if I run telnet xxx.xxx.xxx.xxx 80 & OPTIONS / HTTP1.0 from our network it reports 0.9.8x:

Code:

HTTP/1.1 200 OK
Date: Tue, 19 Feb 2013 10:20:37 GMT
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8x DAV/2
Allow: POST,OPTIONS,GET,HEAD
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html

Connection to host lost.

W:>


I’ve been advised to use OPTIONS / HTTP1.0 to determine which version is genuinely being used.

We have in the past installed SSL by package (the most recent being 1.0.1) & source (presumably the most recent being 0.9.8x).

I need to upgrade SSL on this server & I would like to use the 1.0.1 stream (I understand packages are more likely to be available for this & that’s certainly easier to install). But I can’t figure out why the system is really using 0.9.8x when the server itself is saying that 1.0.1 is being used.

I am assuming that the OPTIONS / HTTP1.0 command is giving me the true version.

Can anyone clarify what might be happening & advise how I can start using 1.0.1?

Thanks, Chris

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Find the occurence of particular string in log file

By maddyroxI have a log file which looks like this:

[2012-12-04 13:54:15,744]

I have to extract DATE and number of times the keyword STATUS is shown on each date.

Input is : [2012-12-04 13:54:15,744]
Output: in excel file, Column1(date) Column2(Number of occurences)
My excel file should also contain all the dates, if on any particular day, STATUS keyword is not found, it will show count as 0

Please help me ASAP. I am in very urgent need of this shell script.
Source: The UNIX and Linux Forums