0

Is there a way to determine if a database is online? Specifically if it's not in "full shutdown" mode.

Using gstat requires running as root or the firebird user according to the docs:

gstat-fb -header "$db" | grep -E 'Attributes.+full shutdown'

Returns with "Permission denied".

I came up with this but surely there's a better way:

re='^Target shutdown mode is invalid for database'  
ret=$(gfix -USER "$usr" -PAS "$pwd" -shut full -tran 5 localhost:"$db" 2>&1)
        
if [[ $? -eq 0 ]]; then
  printf "Info: database '%s' has been shutdown\n" "$db"
else
  if [[ $ret =~ $re ]]; then
    printf "Info: database '%s' was already in full shutdown mode\n" "$db"
  else
    printf "Error: couldn't stop database '%s': '%s'\n" "$db" "${ret//$'\n'/ }" 1>&2
    return 1
  fi
fi

return 0

Firebird Version: 2.5

Bangaio
  • 150
  • 1
  • 7

0 Answers0