Not really, other than now we can make an educated guess and say that you are using a Solaris system.
To know what shell you're using for this script, we need to know how the script was invoked, and, unless it was invoked by giving its filename as an operand to a command interpreter, we need to see the 1st few lines of the script itself. Since you said earlier that the 1st line of the script is:
Code:
#! /bin/sh
so this script is probably being run by a Bourne shell.
Saying:
Quote:
Thanks for the suggestion Don, it didnt work though. I know that the bpend script is being called at the end of the backup as just having a simple "touch filename" create the file.
doesn't help us help you. How did you determine that it didn't work? Did it touch the wrong file? Did it issue a diagnostic message? Did it fail to touch either file?
Please get into the habit of supplying details about what happened and about what didn't work so the volunteers here can more accurately diagnose what is going on and help you find a solution to your problems expeditiously.
Using a Bourne shell:
Code:
if [ "$5" == '0' ]
and
if [ '$5' == '0'
should both issue a diagnostic message,
but:
Code:
if [ "$5" = '0' ]
and
if [ "$5" -eq '0' ]
should both work correctly and produce the same results as long as $5 expands to an integer that fits into a int or a long depending on the vintage of the shell. I prefer the 1st form because it will also correctly test for equality even if the given argument is an empty string, a number that is out of the range supported for arithmetic operations by your shell, or contains text instead of numeric value.
Please add the following statement as a new line of code just before your if statement:
Code:
printf 'Before if: $5 is "%s"\n' "$5"
run the script again, and tell us exactly what happened.
ive attached an unmodified version of the bpend script that i am trying to put my if statement into, if that helps.
ive not been able to run Don's test yet as the server is having some patches applied.
this script runs as part of a backup using Netbackup. so the backup will run, and when it completes, it will trigger this script if it exists (it doesnt have to exist, its used for running post backup commands).
so all i'm trying to do is to get it to create a flag file that says "successful" is the backup status is 0, and "failed" if it isnt 0
---------- Post updated at 04:49 PM ---------- Previous update was at 04:46 PM ----------
ah, it wont let me upload, i will paste it in instead
Code:
#! /bin/sh
# $Header: bpend_notify.sh,v 1.3 2003/08/13 14:11:54 $
#
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 2013 Symantec Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght
#
# bpend_notify.sh
#
# This script is called by NetBackup when bpbkar is finished doing a
# backup on the client. It is also called after backing up the files
# for a user directed archive, but before the files are deleted.
#
# This script:
# receives 5 parameters: CLIENTNAME POLICYNAME SCHEDNAME SCHEDTYPE STATUS
# must be executable by the root user
# should exit with 0 upon successful completion
#
# If this script will not complete within a few seconds, you should set
# the BPEND_TIMEOUT in the /usr/openv/netbackup/bp.conf file on the server.
# You should also be aware that the time taken by this script will slow
# down other backups that are waiting for this client to complete.
#
# This script should be installed with mode 555 so that user directed
# backups and archives will be able to execute this script.
#
# CAUTION: writing anything to stdout or stderr will cause backup problems
#
# --------------------------------------------------------------------
# main script starts here
# --------------------------------------------------------------------
umask 022
if [ "$#" -ne 5 ]
then
exit 1
fi
if [ "$4" = "FULL" -o "$4" = "INCR" -o "$4" = "CINC" ]
then
OUTF=/usr/openv/netbackup/bin/BPEND_CALLED
# You may want to delete the output file elsewhere in order to
# accumulate successful backup information.
# If so, comment out the following 4 lines.
if [ -s $OUTF ]
then
/bin/rm -rf $OUTF
fi
if [ ! -f $OUTF ]
then
touch $OUTF
fi
case "$4"
in
"FULL")
echo `date` full backup finished on $1 - policy $2 schedule $3. Exit status = $5 >> $OUTF
;;
"INCR")
echo `date` differential incremental backup finished on $1 - policy $2 schedule $3. Exit status = $5 >> $OUTF
;;
"CINC")
echo `date` cumulative incremental backup finished on $1 - policy $2 schedule $3. Exit status = $5 >> $OUTF
;;
esac
#
# might want to mail this info to someone
#
# cat $OUTF | mail -s "NetBackup backup finished" someone_who_cares
#
# CAUTION: some platforms do not allow the -s parameter on mail
#
fi
exit 0
I have to pull files from a customers cloud directory to our cloud directory periodically, the customer has the files in the new-version(nver) folder; which I am pulling via a python script. (python nver.py)
customers cloud location:
s3://custbucket/$nver/files
Our cloud location:... (0 Replies)
Hi team,
I have two select statements and need to run them using SYSDBA user
select * from temp_temp_seg_usage;
select segment_name, tablespace_name, bytes/ (1024*1024) UsedMb from
dba_segments where segment_name='TEMP_TEMP_SEG_USAGE';
Need to run this using a shell script say named... (1 Reply)
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
I have a file that contains these lines
User ID Username
-------- ----------
7738626,zrazak
7783535,jvincigu
7805567,ldrennan
7805583,mtsakama
I need to sort the names alphabetically
How can I sort the lines based on the user names ?
I would appreciate a quick reply anyone
... (1 Reply)
hi guys, i am a noob to shell scripting, and i would like to run a simple script, that could simply do the following: 1. SFTP to a remote server/path...and download the newest *.gz backup file on that server. (there are many *.gz files in that folder, i simply need the latest one) 2. locally... (1 Reply)
I have a script that will check for integer line by line and if it encounter any blank space will echo it:
Below the script:
#!/bin/ksh
while read i
do
echo "Value is $i"
count=`expr substr "$i" 1 3`
echo $count
if &&
then
echo "Matched"
else
echo "Blank Space Found"
fi (3 Replies)
I am trying to print my script arguments, but i am stuck at the arrow pointed lines..please help
#!/bin/bash
echo "Number of arguments $#"
count=1
while
do
echo ${$count} <========================
count = $(expr $count +1) <==================
done (4 Replies)
Here is the script that i am trying to run. I get an error and i can't figure out what is the problem.
#!/bin/bash
echo "What is your name"
read NAME
if ; then
echo "My name is the same"
esle
echo "You have a nice name"
fi (11 Replies)
I need a script that checks to see if ypserv is running, and if not it will restart yp.
I have a ypslave that is running Sol9, and the ypsrv daemon is dieing, I want to create a cron job that periodicly checks to see if it's running, and if it see's that it isn't, it will re-start the daemon (1 Reply)