Bash Shell Scripting
Crash Course
crowfly.net

<<   >>

Introduction

GNU_Tools

Example1

Example2

Execution_bit

Bang_bin_bash

Example3

The_dot

Example4

Example5

Example6

Example7

Example8

Background

Forking

Example9

Bash_profile

Pattern_match

Regex

Debug

Gory_details

References

<<   >>
Example 8

This script is used to start up a server process that needs a java runtime environment:

It illustrates how to set and use variables.

It also makes a very good use of logging mechanisms.

start_fisheye

  #!/bin/bash
  
  export JAVA_HOME='/usr/lib/java/jre'
  fdir=/software/fisheye/fisheye-1.0.1
  logdir=/var/log/fisheye
  echo >> $logdir/error_log
  date >> $logdir/error_log
  $fdir/bin/run.sh >> $logdir/output_log 2>> $logdir/error_log &

stop_fisheye

  #!/bin/bash
  
  #fdir=/software/fisheye/fisheye-0.10
  fdir=/software/fisheye/fisheye-1.0.1
  $fdir/bin/stop.sh 

Notice the ampersand (&) on the end of the last line in start_fisheye.

That sends the process into the background.

More on that in the next slide ...