System information
Shell Script Examples
Axis Communications AB provides NO support for application development of any kind. The information
here is provided "as is", and there is no guarantee that any of the examples shown will work in your
particular application.
Revision 1.02 October 2002 70
6 Shell Script Examples
The following pages contain complete shell scripts, which are customized for the most common
applications.
Shell Scripting Tips
• Include #!/bin/mish –x to debug your scripts. Run via Telnet.
• A very useful program for fetching or uploading scripts to the product, Ultra Edit, can be
downloaded from http://www.ultraedit.com/
6.1 The configuration file
The configuration file is located in the /etc/applications directory. At the beginning of
each script, a configuration file is sourced, to identify the variables inside.
This file allows you to use the same scripts, but with different parameters for each of them. A
typical example is to upload files to a particular ftp-server for each camera. You would then
create different config files and call the script with the correct parameters.
# Read the config file
. /etc/applications/config_$1
# Read the optional config file
if [ -e /etc/applications/pre_config_$1 ]; then
. /etc/applications/pre_config_$1
fi
# --- General camera parameters ---
# The index of the name(s) of the buffer(s) started
sources="1"
# The format of the images specified to be taken according to HTTP-API
image_format="fullsize"
# The name to be given to the local file, excluding the extension
file_format="snapshot"
# Number of pre alarm images to be taken
pre=2
# Number of post alarm images to be taken
post=2
# Delay between pre-images in milliseconds
predelay=1000
# Delay between post-images in milliseconds
postdelay=1000
# Delay between image taken
delay=2000
# The time in seconds to stay in the script. A value of -1 means
# indefinitely
time=10
# The index of the name(s) of the buffer(s) started for sequential
# images
Edit your own parameters below: