Bash script Validations/Best Practices
I am writing a Bash script to set some environment variables and then start a web server. What are some good validation checks to add to the script to make sure it is a fail proof as possible:

      1 #!/bin/bash
      2 
      3 # Allow checking that variables don't get set to empty strings.
      4 set -o nounset
      5 
      6 readonly qi_redmine_base="/srv/redmine"
      7 
      8 if test "${qi_redmine_base}" -eq "notset"
      9 then
     10 »···echo
     11 fi
     12 
     13 readonly qi_redmine_etc="/etc/redmine/default"
     14 
     15 if test "${qi_redmine_etc}" -eq "notset"
     16 then
     17 »···echo
     18 fi
     19 
     20 
     21 readonly RAILS_ETC="${qi_redmine_etc}"
     22 export RAILS_ETC
     23 
     24 readonly RAILS_LOG="${qi_redmine_base}/log"
     25 export RAILS_LOG
     26 
     27 readonly RAILS_VAR="${qi_redmine_base}"
     28 export RAILS_VAR
     29 
     30 readonly RAILS_CACHE="${qi_redmine_base}/tmp"
     31 export RAILS_CACHE
     32 
     33 export RAILS_ENV=production
     34 export X_DEBIAN_SITEID=default
     35 
     36 
     37 ruby /usr/share/redmine/script/server webrick -e production
     38 if [$? -ne 0]; then
     39   echo "Server failed to start"   

Any help is greatly appreciated!

Greg
Bash script Validations/Best Practices
===

I am writing a Bash script to set some environment variables and then start a web server. What are some good validation checks to add to the script to make sure it is a fail proof as possible:

      1 #!/bin/bash
      2 
      3 # Allow checking that variables don't get set to empty strings.
      4 set -o nounset
      5 
      6 readonly qi_redmine_base="/srv/redmine"
      7 
      8 if test "${qi_redmine_base}" -eq "notset"
      9 then
     10 »···echo
     11 fi
     12 
     13 readonly qi_redmine_etc="/etc/redmine/default"
     14 
     15 if test "${qi_redmine_etc}" -eq "notset"
     16 then
     17 »···echo
     18 fi
     19 
     20 
     21 readonly RAILS_ETC="${qi_redmine_etc}"
     22 export RAILS_ETC
     23 
     24 readonly RAILS_LOG="${qi_redmine_base}/log"
     25 export RAILS_LOG
     26 
     27 readonly RAILS_VAR="${qi_redmine_base}"
     28 export RAILS_VAR
     29 
     30 readonly RAILS_CACHE="${qi_redmine_base}/tmp"
     31 export RAILS_CACHE
     32 
     33 export RAILS_ENV=production
     34 export X_DEBIAN_SITEID=default
     35 
     36 
     37 ruby /usr/share/redmine/script/server webrick -e production
     38 if [$? -ne 0]; then
     39   echo "Server failed to start"   

Any help is greatly appreciated!

Greg