Sponsored Content
Full Discussion: Simple if script
Top Forums Shell Programming and Scripting Simple if script Post 302896634 by richs24 on Tuesday 8th of April 2014 11:49:58 AM
Old 04-08-2014
Quote:
It could also be the POSIX shell on HPUX .
Don was right, it is Solaris.

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

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help with simple script

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)
Discussion started by: jdel80
1 Replies

2. Shell Programming and Scripting

Simple Script

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)
Discussion started by: xplod4202
11 Replies

3. Shell Programming and Scripting

simple script

Hi, I just need a shell script to find out the processes taking longer time...(Unix/Linux) Urgent response needed.. Rajiv (5 Replies)
Discussion started by: rajivn786
5 Replies

4. UNIX for Dummies Questions & Answers

Simple script

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)
Discussion started by: chvs2000
4 Replies

5. Shell Programming and Scripting

Simple script

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)
Discussion started by: ali560045
3 Replies

6. Shell Programming and Scripting

Simple Script to do so?

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)
Discussion started by: Confidence
1 Replies

7. Shell Programming and Scripting

Simple Script Can u help please?

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)
Discussion started by: mnassiri
1 Replies

8. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

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)
Discussion started by: torchij
16 Replies

9. Linux

How to execute a simple select script using a shell script?

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)
Discussion started by: pamsy78
1 Replies

10. Shell Programming and Scripting

Simple script

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)
Discussion started by: ramky79
0 Replies
DKOPP(1)							  Dkopp man page							  DKOPP(1)

NAME
Dkopp - copy files to DVD or BD (Blue-ray) media SYNOPSIS
dkopp [ -job | -run ] jobfile dkopp [ -nogui ] -script scriptfile DESCRIPTION
Dkopp copies files to backup DVD or BD media. It supports full or incremental backups and full or incremental media verification. OVERVIEW
Dkopp is a menu-driven GUI (GTK) program operating in its own window. Dkopp copies files and directories specified in a job file to DVD or BD media. Dkopp can copy all files to empty media (full copy), or only new and modified files to previously used media (incremental). Files and directories to include or exclude can be selected from the file system hierarchy using a GUI navigator. Specifications are saved in a job file which can be re-edited and re-used. Script files can be run in batch mode using the -nogui option. Dkopp can be used to select and restore files previously copied, and owner and permission data is also restored. The DVD/BD media can also be accessed with file system tools like Nautilus. Dkopp supports the following functionalities: - Three backup modes: full, incremental, accumulate. - Three media verification modes: full, incremental, thorough. - Use write-once or re-writable DVD or BD media (but not CD). - Report disk:backup differences in detail or summary form. - Select and restore files from a backup copy (or use drag and drop). - Search log files to find media where specified files are saved. OPTIONS
Command line options: [ -job ] jobfile open job file for editing -run jobfile execute a job file [ -nogui ] -script scriptfile execute a script file SEE ALSO
The online user manual is available using the menu Help > contents. This manual explains Dkopp operation in great detail. Dkopp uses the batch programs grwoisofs and genisoimage. Dkopp is essentially a GUI front-end for these programs. AUTHORS
Written by Mike Cornelison <kornelix2@googlemail.com> Linux 2010-10-01 DKOPP(1)
All times are GMT -4. The time now is 09:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy