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 73
The script itself continues:
#!/bin/mish
PATH=/bin:/sbin:/usr/bin:/usr/sbin
# 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
# Stop the, by utask, started buffers
bufferd -stop -buffername $2
# Path of the status file
status_file="/tmp/$2/status"
# Wait until bufferd is ready with the images, i.e. the status file is
# present and delete it after
expr $predelay + $postdelay > /tmp/A
tmp=`cat /tmp/A`; expr $tmp / 1000 > /tmp/A
tmp=`cat /tmp/A`; rm /tmp/A
while[!-f$status_file ]; do
sleep $tmp
done
rm $status_file
# FTP connection
if [ x$passive_mode = xyes ]; then
sftpclient -L -s -m $ftp_server –n $port -c $destination -k /tmp/$2 -u $user
-w $pass
else
sftpclient -L -m $ftp_server –n $port -c $destination -k /tmp/$2 -u $user -w
$pass
fi
# Reset and restart buffers
bufferd -reset -buffername $2
bufferd -start -buffername $2 -pre "$pre" -post "$post" -predelay
"$predelay" -postdelay "$postdelay" -uri
ftp://jpg/$sources/$image_format".jpg"
6.2.1.1 Task.list
The first entry in the task.list will start a buffer (CAM1) that continuously fetches 2 pre-alarm
images from camera 1 and is prepared to fetch 2 post-alarm images. The images are fetched at a
rate of 1 frame per second (1000ms).
# When the server is running, start capturing images in a buffer named
# IO0 with 2 pre and post-alarm pictures, 1000 ms of delay between pre
# and post images with the specified URI.
once immune % /bin/bufferd : -start -buffername IO0 -pre 2 -post 2 -predelay
1000 -postdelay 1000 -uri ftp://jpg/1/352x288.jpg;
# If a positive transition is detected on the IO port 0, execute the
# script for the first camera and the buffer named IO0 (the same as the