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 80
The script itself:
#!/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/E
tmp=`cat /tmp/E`; expr $tmp / 1000 > /tmp/E
tmp=`cat /tmp/E`; rm /tmp/E
while[!-f$status_file ]; do
sleep $tmp
done
rm $status_file
# Test if cc is present, if yes add -c $cc to the command, otherwise
# leave blank
if [ x$cc != "x" ]; then
copy="-c $cc"
fi
# Send the mail
smtpclient -s $subject -S $smtp_server -f $from -r $reply $copy -b $body -M
2 -d /tmp/$2 $to
if [ $? -eq 1 ]; then
logger -t $0[$$] SMTP failed!
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.4.1 Task.list
This task.list can be used to run the script above.
# 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