Caché backup ShellScript

Answers

Hi Danillo, 

we use a similar mode to do it, 

first, you have to stop caché or Freeze it,

you can create a script to start it and add it on crontab:


su "user" -c 'csession CACHE -U %SYS "##Class(Backup.General).ExternalFreeze("","","","","",,7200,"","")"'


Then you have a list of databases you have to copy, or execute a snapshot.

in the end of the script, you have to do the ExternalThaw():


su "user" -c 'csession CACHE -U %SYS "##Class(Backup.General).ExternalThaw"'


you can verify the Status, like This:


status=$?

if [ $status -eq 5 ]; then
    echo "SUCCESS: System Resumed"
    exit 0
elif [ $status -eq 3 ]; then
    echo "ERROR: System is not Resumed"
    exit $status
fi

echo "ERROR: System is not Resumed"
exit $status