Jump to content

Recommended Posts

Posted

Сам скрипт

#!/bin/sh

if [ $# -lt 1 ]; then
	echo "Usage: $0 <cam number>"
	exit 1
fi

CAMNUM="$1"
if [ "$CAMNUM" -eq 1 ]; then
	IP='192.168.1.101'
else
	echo "Unknown cam number: \"$CAMNUM\""
	exit 1
fi

while true; do
	if ping -c1 -t1 "$IP" >/dev/null 2>/dev/null; then
		# 2016-02-29
		DATE=$(date '+%F')
		START=$(date '+h-m-s_%H-%M-%S')

		mkdir -p /Cams/cam0$CAMNUM/$DATE

		ffmpeg -i "rtsp://$IP/user=admin&password=admin" -vcodec copy -an -t 3600 "/Cams/cam0$CAMNUM/$DATE/${START}.avi" </dev/null >/dev/null 2>/dev/null
	else
		echo "No ping to camera \"$IP\""
		sleep 5000
	fi
done

Не работает ни одна функция внутри while true; do, кроме echo, хотя через ssh команды по отдельности работают.

entware3x

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

This site uses cookies. By clicking "I accept" or continuing to browse the site, you authorize their use in accordance with the Privacy Policy.