scripting - No such file or directory from sh script -


looking origin of error message:

processing: +([^_]).flv date: +([^_]).flv: no such file or directory 

i started getting @ point in last few months (can't when wasn't logging cron output. know, know!).

when wrote this, worked ok @ least 2 months. i'm wondering if there sh update broke it?

the script runs via crontab , gets .flv files in current directory without underscore , processes each one. checks modified date files have been created in last 24 hours , runs yamdi meta tag injector .flv files.

it seems it's not recognizing pattern pattern , looking actual file me. if run script ssh shell works ok, it's when running via cron gives error.

shopt -s extglob now=$(date +"%s") f in +([^_]).flv;    echo "processing: $f"         age=$(date -r  "$f" +"%s")         calc=$(((now-age) / 60 / 60))         if(( calc < 24 ));                 echo "$f age=$calc"                 yamdi -i "$f" -o "$f".seek                 rm "$f"                 cp "$f".seek "$f"                 touch -d @$age "$f"          fi done 

this problem of wrong shell being used; make sure script's first line represents right shell:

#!/bin/bash 

for bash, or whatever shell wrote for. might want check environment variables cron may set (that's common problem -- 1 assumes set correctly, environment cron offers scripts executes different).


Popular posts from this blog