Can we create any check-point feature in shell ?

I have a script as below and say its failed @ function fs_ck {} then it should exit and next time i execute it it should start from fs_ck {} only

Please advise

#!/bin/bash

logging {}
fs_ck {}
bkp {}
dply {}

## main function###
echo Sstarting script
echo '####'

logging
fs_ck
bkp
dply

Thanks in advance
abhaydas

Hi abhayda...
I am curious what are the first four functions are supposed to do except cause errors?
They should look something like this:

function logging
{
        # There MUST be some code here, using NOP as an example.
        # The colon used as a NOP, DEMONSTRATION placeholder.
        :
}

OR in your case the same would be...

function logging { :; }

This should help you on your way...

HI wisecraker.

Say below is my code for logging and fs_ck function
if script fails at fs_ck function then script should remember this and next time i execute my script it should start from failed point

function logging  {
        ssh abc@def
        
                if [[ $? -eq 0 ]]; then
                       echo "Successfull"
			    else 
				      echo "Failure"
                        
                fi
        
}
function fs_ck {
        
        A=`ssh abc@def df -kh . | awk '{print $5}' | tail -1`
        A="${A:0:2}"
        if [ $A -lt 85 ];then
                echo " space issues"
        else
                echo " fine"
        fi
}

This question has been covered before in these forums; try searching for proposed solutions. This is one of the possible search results.
You could work with - let's call it - "status files". When a function has finished satisfactorily, touch a result file, and skip execution of the function if it exists, like

bkp ()          { touch ${FUNCNAME[0]}.done; }
logging ()      { touch ${FUNCNAME[0]}.done; }
dply ()         { touch ${FUNCNAME[0]}.done; }
fs_ck ()        { if false; then  touch ${FUNCNAME[0]}.done; else return $?; fi }
for FN in logging fs_ck bkp dply; do [ -f "${FN}.done" ] || { if ! ${FN}; then echo $?; break; fi; };  done 

This will execute your functions in the desired order if the result file does not exist. For fs_ck it will fail, won't create the result file, and start over with fs_ck skipping the logging function. Give it a try and report back.