I am running a bash script as a cron job. The thing is that I use ls in the script and it says that absolute path file doesn't exist. But it exists:
function get_curr_video_size()
{
curr_size=`ls -l ${video_name} | awk '{print $5}'`
echo ${curr_size}
}
curr_size=`get_curr_video_size`
${video_name} is get by another function at earlier point, so it can't be non-existent during get_curr_video_size call.
Error is:
ls: cannot access /home/pi/draft_videos/03_04_2017/test_03_04_2017_22:05:19.mp4: No such
file or directory`
But the file exists. When I ls it in terminal it is there:
ls -l /home/pi/draft_videos/03_04_2017/test_03_04_2017_22:05:19.mp4
-rw-r--r-- 1 pi pi 0 Apr 3 22:05 /home/pi/draft_videos/03_04_2017/test_03_04_2017_22:05:19.mp4
If I run my script in a terminal instead as a cron job, it is ok. Seems like cron messes up things somehow, but I can't understand why.
I am using Raspbian Jessie on RPI.