Tag Archives: LOGNAME

403-009 The specified number is not valid for this command.

By Daniel Gate

PHP Code:


Error Message: dm2_oraver: 9xdm2_oraver2: LT11/w_standard/gold_wh/install/dm2_updatetns.ksh[385]: 11MAR13: 0403-009 The spe
cified number is not valid
for this command.




if [385] means the line number in the ksh, it is
((CntNew=Cnt+1)) .

Please let me know the best way to debug and find it out. I am running the built-in ksh, but getting the error.

HTML Code:

#!/bin/ksh

# Mod Date Engineer Change
# 000 07/20/04 AM4598 Created dm2_updatetns.ksh based on updatetns.ksh for new installs.
# 001 01/09/06 EG012557 Modified to default to Oracle 9 path of logic when on Oracle 10
# 002 02/16/06 EG012557 Modify to use : instead of . for chown commands that would run in mode T
# 003 06/23/06 EG012557 Modify to use : instead of . for chown commands that would run in mode A
# Modify listener.ora searching for account for Oracle 10
# Add export UNIX95=Y when on HPUX
# 004 11/17/08 EG012557 Modify to use case-insensitive search when looking for existing TNS entry
# 005 01/29/10 Bg8255 Modifications for Oracle 11.

OnError()
{ # $* = message to write
echo "n$*n"
exit 1
}

CheckUser()
{
if [[ $LOGNAME != $1 ]]
then
OnError "Incorrect user $LOGNAME. Login as $1 and try again."
fi
}

GetPort()
{
if [[ `grep -w $NewPort /etc/services | wc -l` -ne 0 ]]
then
if [[ `grep -w $NewPort /etc/services|egrep -e "oracle|tns"|wc -l` -eq 0 ]]
then
OnError "Port Number $NewPort reserved by a non-Oracle process."
fi
else
echo " "
echo "Execute the following commands as the root user to reserve port # $NewPort in the /etc/services file:"
echo " chservices -a -v'oracle_tns' -p'tcp' -n $NewPort -u'# Oracle

From: http://www.unix.com/shell-programming-scripting/220985-403-009-specified-number-not-valid-command.html

To create a program illustrating SUID

By ravisingh

To understand SUID feature, I set SUID bit for a SHELL script.
Then I executed the program by a different user.

In order to understand how it works, I tried different ways like:

1) I didn’t give execute permission for the other user (not an owner) and then he tried to execute it.

2) I made the script coded in a way so that when the owner runs, it behaves differently than when other user runs. This I did by including $LOGNAME in the script.

I also tried a few other ways to understand SUID but all these couldn’t make me get how SUID works.

Please give me a SHELL script or whatever required so that I get how SUID can be used in real time.

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

How to change crontab output from console to email?

By hgjdv

Hi,

We are currently running AIX 6.1 TL4. There are around 30 ksh scripts that are ran from crontab which if an error occurs or a problem with an ftp unix sends the out of the ksh script which goest to our console via the local user hci which is viewed by the mail command. I’ve tired adding the MAILTO=Test@email.com varaible to the crontab doing a crontab -e as well as adding the variable MAIL=Test@email.com but neither options seemed to work.

I was able piple a mail command to the end of the cron entry however it only displays my subject. It does the job of notifying of an issue but doesn’t contain the actual output shown below when looking at the message via mail commad. That option would work but I want any of these jobs to email us and having to piple a mail for each just doesn’t seem efficient.

I’m not for sure if our version of AIX doesn’t support the mailto varible or if I’m doing something incorrectly. I’m searched this and googled this topic and have tried those variables as well as setting up an aliase which didn’t seem to work as well.

I see in the LOGNAME variabile in the output below has hci but I’m not for sure if that is what is being used as the TO: setting for the emial or if there is a config file somewhere that I can update to set the desired email address. Any help would be appreciated.

Example of crontab entry used for piping email would prefer to just have all the crontab jobs for the user hci send an email out instead of having to pipe a mail to each entry. Also I’m not wanting thsi email address to reiceve emails from the root crontab on the hic usr.
00,5,10,15,20,25,30,35,40,45,50,55 * * * * setroot; /qdxtest/qdx5.7/integrator/kshlib/SJS_SFTMD_ftp | mail -s “test” -r “root” “Test@email.com”

From root Thu Jan 17 11:15:00 2013
Received: (from root@localhost)
by hsdvim2b.test.local (AIX6.1/8.13.4/8.11.0) id r0HHF0FP5275882
for hci; Thu, 17 Jan 2013 11:15:00 -0600
Date: Thu, 17 Jan 2013 11:15:00 -0600
From: root
Message-Id:
To: hci
Subject: Output from cron job setroot; /qdxtest/qdx5.7/integrator/kshlib/SJS_SFTMD_ftp, hci@hsdvim2b, exit status 0

Cron Environment:
SHELL = /usr/bin/sh
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin
CRONDIR=/var/spool/cron/crontabs
ATDIR=/var/spool/cron/atjobs
LOGNAME=hci
HOME=/home/hci

Your “cron” job executed on hsdvim2b on Thu Jan 17 11:15:00 CST 2013
setroot; /qdxtest/qdx5.7/integrator/kshlib/SJS_SFTMD_ftp

produced the following output:

bogusvar

*****************************************************************
cron: The previous message is the standard output
and standard error of one of the cron commands.

Source: FULL ARTICLE at The UNIX and Linux Forums