Sponsored Content
Top Forums UNIX for Advanced & Expert Users Resume from last failed command Post 302919327 by gull04 on Tuesday 30th of September 2014 12:04:49 PM
Old 09-30-2014
Hi,

OK, I can't let you have the whole script - but below is a typical section from the script. Please bear in mind that this is a singlr section of the script and that there are many such sections.

Code:
# ----------------------------------------------------------------------------------------------------
# check filesystems if not exists then create it"
# ----------------------------------------------------------------------------------------------------
#
#   STEPTOINFO[  4 ]=0 # check filesystems if not exists then create it
    STEPCOUNT=4
    if [ ${STEPTOINFO[$STEPCOUNT]} -ne 0 ]; then
#   {
        printf "$STEPCOUNT" >  "$SAVE_LAST_BREAK"    # save actally position
        printf "$STEPCOUNT; " >> "$SAVE_LAST_ACTIVITY"
#
        if [ "$GLOBAL_ZONE" = "$TRUE" ]; then
#       {
# ----------------------------------------------------------------------------------------------------
#
            ANZINFORMATION=$((ANZINFORMATION + 1))
            INSTALLINFORMATION[$ANZINFORMATION]="SECTION -  %2d : ${SECTION_INFO[$STEPCOUNT]}"
#
            showheader "${INSTALLINFORMATION[$ANZINFORMATION]}" "$STEPCOUNT" "$BACKGROUND"
#
            ERRORFOUND=0
            ERRORINFORMATION[$ANZINFORMATION]="Perfect"
#
# ----------------------------------------------------------------------------------------------------
# needed Filesystems:
#
            ZFS_RPOOL_FILESYS="rpool/UC4                                                            \
                               rpool/export rpool/export/home                                       \
                               rpool/local  rpool/local/Tivoli rpool/local/bmc rpool/local/oracle   \
                               rpool/zzz    rpool/zzz/core                                          \
                               rpool/oracle                                                         \
                               rpool/TAD4D"
# save this info in an array
#
            i=-1
            for ZFS_RP_FS in $ZFS_RPOOL_FILESYS
            do
                i=$((i + 1)); ZFS_RPOOLFS[$i]=$ZFS_RP_FS
            done
#
# ----------------------------------------------------------------------------------------------------
# needed Mountpoint for zfs filesystems:
#
            i=-1
            ZFS_FILESYSTEMS="/UC4                                                                \
                             /export     /export/home                                            \
                             /usr/local  /usr/local/Tivoli  /usr/local/bmc /usr/local/oracle     \
                             /zzz        /zzz/core                                               \
                             /oracle                                                             \
                             /opt/TAD4D"
# save this info in an array
#
            i=-1
            for ZFS_FS in $ZFS_FILESYSTEMS
            do

                i=$((i + 1)); ZFS_RPOOLFS[$i]=$ZFS_RP_FS
            done
#
# ----------------------------------------------------------------------------------------------------
# needed Mountpoint for zfs filesystems:
#
            i=-1
            ZFS_FILESYSTEMS="/UC4                                                                \
                             /export     /export/home                                            \
                             /usr/local  /usr/local/Tivoli  /usr/local/bmc /usr/local/oracle     \
                             /zzz        /zzz/core                                               \
                             /oracle                                                             \
                             /opt/TAD4D"
# save this info in an array
#
            i=-1
            for ZFS_FS in $ZFS_FILESYSTEMS
            do
                i=$((i + 1)); ZFS_FILESYS[$i]=$ZFS_FS
            done
#
# ----------------------------------------------------------------------------------------------------
# needed quotas for zfs filesystems:
#
            ZFS_FILESYS_QUOTAS="250M                                                              \
                                  3G          2G                                                  \
                                  3G          262M               520M            520M             \
                                  2G          1G                                                  \
                                 10G                                                              \
                                250M"
# save this info in an array
#
            i=-1
            for ZFS_FSQ in $ZFS_FILESYS_QUOTAS
            do
                i=$((i + 1)); ZFS_FSQUOTAS[$i]=$ZFS_FSQ
            done
#
# ----------------------------------------------------------------------------------------------------
#
            i=-1
            while [ $i -lt $(( ${#ZFS_FILESYS[*]} - 1)) ]
            do
#           {
                i=$((i + 1))
                typeset -L20 TMP_ZFS_RPOOLFS
                typeset -L20 TMP_ZFS_FILESYS
                TMP_ZFS_RPOOLFS="'${ZFS_RPOOLFS[$i]}'"
                TMP_ZFS_FILESYS="'${ZFS_FILESYS[$i]}'"
#
                /usr/sbin/zfs list | grep "${ZFS_RPOOLFS[$i]}" > /dev/null 2>&1
                RC=$?
                if [ $RC -eq 0 ]; then
#               {
#           {
                i=$((i + 1))
                typeset -L20 TMP_ZFS_RPOOLFS
                typeset -L20 TMP_ZFS_FILESYS
                TMP_ZFS_RPOOLFS="'${ZFS_RPOOLFS[$i]}'"
                TMP_ZFS_FILESYS="'${ZFS_FILESYS[$i]}'"
#
                /usr/sbin/zfs list | grep "${ZFS_RPOOLFS[$i]}" > /dev/null 2>&1
                RC=$?
                if [ $RC -eq 0 ]; then
#               {
                    if [ -d "${ZFS_FILESYS[$i]}" ]; then
#                   {
# >> zfs rpool/fs is available !!!
# >> directory    is available !!!
                        showmessages "...     NOTE: $TMP_ZFS_RPOOLFS and $TMP_ZFS_FILESYS exists" "Perfect" "$BACKGROUND"
#                   }
                    else
#                   {
                        showmessages "...     NOTE: $TMP_ZFS_FILESYS not exists" "Faulty" "$BACKGROUND"
                        ERRORFOUND=1
#                   }
                    fi
#               }
                else
#               {
# >> zfs rpool/fs is NOT available !!!
                    showmessages "...     NOTE: $TMP_ZFS_RPOOLFS not exists" "Faulty" "$BACKGROUND"
                    if [ ! -d "${ZFS_FILESYS[$i]}" ]; then
#                   {
# >> directory is NOT available !!!"
                        showmessages "...     NOTE: $TMP_ZFS_FILESYS not exists" "Faulty" "$BACKGROUND"
                        ERRORFOUND=1
#                   }
                    else
#                   {
                        showmessages "...     NOTE: $TMP_ZFS_FILESYS is a directory not a ZFS-Filesystem from $TMP_ZFS_RPOOLFS" \
                                     "Faulty"                                                                                   \
                                     "$BACKGROUND"
                        ERRORFOUND=1
#                   }
                    fi
#               }
                fi
#           }
            done
#
# --------------------------------------------------------------------------------------------------------
#
        if [ $ERRORFOUND -ne 0 ]; then
            GLOBAL_ERROR=-1
            ERRORINFORMATION[$ANZINFORMATION]="Faulty"
        fi
        fi
#
# ----------------------------------------------------------------------------------------------------
#
            if [ $RETURNNEEDED -eq 0 ]; then
                printf "\nenter <RETURN> to continue : "; read FORWARD
            fi
#       }
        fi
#   }
    fi

You should be able to see how the checking is done in each section from this.

Regards

Dave
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Failed to get value from a file using sed command

Hi folks, I have the following file (tnsnames.ora): DB10g = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = buffy)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DB10g) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = ... (2 Replies)
Discussion started by: nir_s
2 Replies

2. What is on Your Mind?

Are companies viewing my resume? How do I track my resume visits?

Hi everybody, I am wondering if there is any tool or website out there which can track who is viewing my resume. It is very frustrating when you send your CV or Cover Letter and you receive no feedback from the company, you don't even know if they have checked it out. Thanks for your help (1 Reply)
Discussion started by: gearyipswich
1 Replies

3. UNIX for Dummies Questions & Answers

Problem with Mail command: exec failed. errno=2.

I am trying to send email using the "mail" command. I keep getting an "exec failed. errno=2." message. Here is one the commands I have tried: mail test@mycompany.com < test1.out Any ideas what may be causing this error msg? (1 Reply)
Discussion started by: hawkman2k
1 Replies

4. UNIX for Advanced & Expert Users

rm & mv command failed due to too many files.

In our directory there are too many files, & if I try to execute mv *.gz or rm *.l command it fails, providing error string as - 'arg list too long'. This doesnt happen always, is there any way we know, limit on the rm & mv command so we can take care of this failure in future executions ? (9 Replies)
Discussion started by: videsh77
9 Replies

5. Shell Programming and Scripting

Rerunning a command in a script that failed?

I have a script that occasionally has a command here and there that fails and I would like to set my script up to just re run the command if the exit code is 1. Is there a simple way to do that without if/thens or redirecting to the command again? (5 Replies)
Discussion started by: trey85stang
5 Replies

6. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies

7. Solaris

command 'cc' failed even though gcc is installed

I'm trying to build some python modules on a Solaris 10 machine. It has gcc as /usr/sfw/bin/gcc. # CC=gcc python setup.py build running build running build_py running build_ext cc -c actread.c -o actread.o unable to execute cc: No such file or directory error: command 'cc' failed with exit... (8 Replies)
Discussion started by: aussieos
8 Replies

8. Hardware

Cannot resume from suspend with new motherboardktop, does not resume properly

I would like to get pm-suspend (or any other suspend method) working for a small new desktop computer. It is based on a Zotac GF-8200 ITX motherboard and an AMD Athlon II X@ 240 CPU using ArchLinux x86_64. The pm-suspend script works, apparently putting the machine into suspend correctly... (0 Replies)
Discussion started by: lagagnon
0 Replies

9. Solaris

Script redirect command output failed, why?

Hi, I put a for loop in a script to eject backup tapes from the robot. The command echo' output goes to the log file without problem, but command vmchange's output does not go to the log file although it's working fine. It still displays on the screen. I've tried '2>&1 1>$log', but nothing changed.... (5 Replies)
Discussion started by: aixlover
5 Replies

10. Solaris

Command failed for target 'check-recursive' error

Sorry if this is the wrong place for this. I haven't done UNIX Admin in a long time and am trying to update the utilities on a Solaris server so that I can get Apache 2.4.25 installed. I am finding a lot of utilities that are just too far out of date and some versions are no longer supported. So... (0 Replies)
Discussion started by: PJ_Namias
0 Replies
All times are GMT -4. The time now is 01:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy