Stephan Wendel b96c2bd86a
BUGFIX: Typo in shellcheck directive
* 'requires' instead of 'require'

Signed-off-by: Stephan Wendel <me@stephanwe.de>
2021-12-17 22:02:00 +01:00

80 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
#### Webcamd Core Application.
#### webcamd - A webcam Service for multiple Cams and Stream Services.
####
#### written by Stephan Wendel aka KwadFan
#### Copyright 2021
#### https://github.com/mainsail-crew/crowsnest
####
#### This File is distributed under GPLv3
####
#### Version 3
# shellcheck enable=require-variable-braces
# Exit upon Errors
set -e
# Base Path
BASE_CN_PATH="$(dirname "$(readlink -f "${0}")")"
## Import Librarys
# shellcheck source-path=SCRIPTDIR/libs/
source "${BASE_CN_PATH}/libs/configparser.sh"
source "${BASE_CN_PATH}/libs/core.sh"
source "${BASE_CN_PATH}/libs/hwhandler.sh"
source "${BASE_CN_PATH}/libs/init_stream.sh"
source "${BASE_CN_PATH}/libs/logging.sh"
source "${BASE_CN_PATH}/libs/messages.sh"
source "${BASE_CN_PATH}/libs/v4l2rtspserver.sh"
source "${BASE_CN_PATH}/libs/ustreamer.sh"
source "${BASE_CN_PATH}/libs/v4l2_control.sh"
source "${BASE_CN_PATH}/libs/watchdog.sh"
#### MAIN
## Args given?
if [ "$#" -eq 0 ]; then
missing_args_msg
exit 1
fi
## Parse Args
while getopts ":vhc:" arg; do
case "${arg}" in
v )
echo -e "\nwebcamd Version: $(self_version)\n"
exit 0
;;
h )
help_msg
exit 0
;;
c )
check_cfg "${OPTARG}"
export WEBCAMD_CFG="${OPTARG}"
;;
\?)
wrong_args_msg
exit 1
;;
esac
done
delete_log
init_log_entry
initial_check
v4l2_control
construct_streamer
## Loop and Watchdog
## In this case watchdog acts more like a "cable defect detector"
## The User gets a message if Device is lost.
clean_watchdog
while true ; do
webcamd_watchdog
sleep 120 & sleep_pid="$!"
wait "${sleep_pid}"
done