-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
142 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
install: | ||
## check if vars are set | ||
source ./check_vars.sh GOPATH | ||
## check for sudo privileges | ||
source ./check_sudo.sh | ||
bash ./check_vars.sh GOPATH | ||
## run go install | ||
go install ./... | ||
## create system-wide symlink to executables | ||
source ./create_symlinks.sh motion-poll set-preset goto-preset set-time | ||
bash ./create_symlinks.sh motion-poll set-preset goto-preset set-time | ||
## create config folder | ||
echo "Path for configuration folder [~/.config/onvif-cam-poll]" | ||
read path | ||
if [ -z "$path" ] | ||
then path="~/.config/onvif-cam-poll" | ||
mkdir -p $path | ||
## create service templates | ||
cp ./services/* $path/. | ||
## overwrite service files - environment file, user, group, execstart | ||
## copy service files to system service folder | ||
## run systemctl daemon-reload | ||
bash ./create_service_templates.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
read -r -p "Path for configuration folder [~/.config/onvif-cam-poll]" $CONFIG_PATH | ||
export CONFIG_PATH=${config_path:-~/.config/onvif-cam-poll} | ||
echo "$CONFIG_PATH" | ||
mkdir --p "$CONFIG_PATH" | ||
export CONFIG_PATH | ||
## create service templates | ||
cp ./services/* "$CONFIG_PATH"/. | ||
envsubst < "$CONFIG_PATH"/motion@.service > "$CONFIG_PATH"/motion@.service.temp && mv "$CONFIG_PATH"/motion@.service.temp "$CONFIG_PATH"/motion@.service | ||
envsubst < "$CONFIG_PATH"/time@.service > "$CONFIG_PATH"/time@.service.temp && mv "$CONFIG_PATH"/time@.service.temp "$CONFIG_PATH"/time@.service | ||
sudo cp "$CONFIG_PATH"/*.service /lib/systemd/system/. | ||
sudo systemctl daemon-reload | ||
echo "To track a new camera create an .env file for it in $CONFIG_PATH" | ||
echo "Fill in all the variables that are listed in the example.env file" | ||
echo "Afterwards, run systemctl start motion@camera_envfile_name" | ||
echo "Don't forget to enable the service if you want it to run after a restart" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
DefaultDependencies=no | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
EnvironmentFile=/home/isaric/.config/onvif-cam-poll/%i.env | ||
Restart=always | ||
RestartSec=3 | ||
User=isaric | ||
Group=isaric | ||
ExecStart=/bin/bash /home/isaric/.config/onvif-cam-poll/motion.sh | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CAMERA_ADDRESS=bla.bla.bla:8899 | ||
CAMERA_USER=admin | ||
CAMERA_PASSWORD=xxxxxx | ||
CAMERA_NAME=garage | ||
SLACK_BOT_TOKEN=xoxb-xxxxxx-xxxxxx-xxxxxx | ||
SLACK_CHANNEL_ID=xxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
motion-poll -a ${CAMERA_ADDRESS} -u ${CAMERA_USER} -p ${CAMERA_PASSWORD} -n ${CAMERA_NAME} -s ${SLACK_WEBHOOK} -t 30 -b ${SLACK_BOT_TOKEN} -c ${SLACK_CHANNEL_ID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
DefaultDependencies=no | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
EnvironmentFile=$path/%i.env | ||
Restart=always | ||
RestartSec=3 | ||
User=$SUDO_USER | ||
Group=$SUDO_USER | ||
ExecStart=/bin/bash $path/motion.sh | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set-time -a ${CAMERA_ADDRESS} -u admin -p ${CAMERA_PASSWORD} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
DefaultDependencies=no | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
EnvironmentFile=$path/%i.env | ||
Restart=always | ||
RestartSec=3 | ||
User=$SUDO_USER | ||
Group=$SUDO_USER | ||
ExecStart=/bin/bash $path/time.sh | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
DefaultDependencies=no | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
EnvironmentFile=${CONFIG_PATH}/%i.env | ||
Restart=always | ||
RestartSec=3 | ||
User=${USER} | ||
Group=${USER} | ||
ExecStart=/bin/bash ${CONFIG_PATH}/goto.sh | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
goto-preset -a ${CAMERA_ADDRESS} -u ${CAMERA_USER} -p ${CAMERA_PASSWORD} -t 30 -l 001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/path/to/motion-poll -a ${CAMERA_ADDRESS} -u ${CAMERA_USER} -p ${CAMERA_PASSWORD} -n ${CAMERA_NAME} -s ${SLACK_WEBHOOK} -t 30 -b ${SLACK_BOT_TOKEN} -c ${SLACK_CHANNEL_ID} | ||
motion-poll -a ${CAMERA_ADDRESS} -u ${CAMERA_USER} -p ${CAMERA_PASSWORD} -n ${CAMERA_NAME} -s ${SLACK_WEBHOOK} -t 30 -b ${SLACK_BOT_TOKEN} -c ${SLACK_CHANNEL_ID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set-preset -a ${CAMERA_ADDRESS} -u ${CAMERA_USER} -p ${CAMERA_PASSWORD} -l 001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
DefaultDependencies=no | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
EnvironmentFile=${CONFIG_PATH}/%i.env | ||
Restart=always | ||
RestartSec=3 | ||
User=${USER} | ||
Group=${USER} | ||
ExecStart=/bin/bash ${CONFIG_PATH}/set-preset.sh | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/path/to/set-time -a ${CAMERA_ADDRESS} -u admin -p ${CAMERA_PASSWORD} | ||
set-time -a ${CAMERA_ADDRESS} -u admin -p ${CAMERA_PASSWORD} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
DefaultDependencies=no | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
EnvironmentFile=/home/isaric/.config/onvif-cam-poll/%i.env | ||
Restart=always | ||
RestartSec=3 | ||
User=isaric | ||
Group=isaric | ||
ExecStart=/bin/bash /home/isaric/.config/onvif-cam-poll/time.sh | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |