Дмитрий Posted August 5, 2017 Share Posted August 5, 2017 Сам скрипт #!/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 Quote Link to comment Share on other sites More sharing options...
edm Posted August 5, 2017 Share Posted August 5, 2017 2 часа назад, Дмитрий сказал: #!/bin/sh замени на #!/opt/bin/sh 1 Quote Link to comment Share on other sites More sharing options...
Дмитрий Posted August 6, 2017 Author Share Posted August 6, 2017 Спасибо! Теперь только свои косяки отлаживать буду. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.