Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with work in bash script #5415

Closed
axsapronov opened this issue Apr 13, 2015 · 4 comments
Closed

Error with work in bash script #5415

axsapronov opened this issue Apr 13, 2015 · 4 comments

Comments

@axsapronov
Copy link

@axsapronov axsapronov commented Apr 13, 2015

Hi all,

I have bash script:

#!/bin/bash

QUEUE_DIR=~/Dropbox/IFTTT/youtube-dl/*.txt
VIDEO_DIR=~/Video/Youtube/
shopt -s nullglob

for queue_file in $QUEUE_DIR
do
    video_url=`cat "$queue_file"`;
    echo "$queue_file : $video_url";
    mv "$queue_file" "${queue_file}.in_proccess";
    youtube-dl --default-search "ytsearch" -o "$VIDEO_DIR%(title)s.%(ext)s" "$video_url" && mv "${queue_file}.in_proccess" "${queue_file}.success"; 
    rm -f "${queue_file}.success";
done

(in txt lines - urls to videos)

and cronline , for example

  • * * * * bash path_to_bash_file

This script used to work. But now is not working. He runs, renames files, and then exits without error. If I run the script manually, everything works fine.

Youtube-dl stopped working in background?

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 13, 2015

Post the output with the --verbose option and explain with detail what's your exact problem.

@axsapronov
Copy link
Author

@axsapronov axsapronov commented Apr 13, 2015

I run this line

youtube-dl --verbose -o test.mp4 http://www.youtube.com/watch?v=zNfTaN76kBk&feature=youtube_gdata  >> log_file.log

If i run manualy, i have get file. But if run this line with crontab (in bash file)...i don't have file and logs.

Magic!

uname -a:
Linux work-laptop 3.16.0-33-generic #44~14.04.1-Ubuntu SMP Fri Mar 13 10:33:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

youtube-dl --version
2015.04.09
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 13, 2015

Redirect stderr and stdout to log file by changing cron task to * * * * * path_to_bash_file >> path_to_log_file 2>&1 and check out the log.

@axsapronov
Copy link
Author

@axsapronov axsapronov commented Apr 13, 2015

Wow!
I got this error:

....dropbox_youtube_dl.sh: line 21: youtube-dl: command not found

but i have youtube-dl:

> youtube-dl                                                                                              
Usage: youtube-dl [OPTIONS] URL [URL...]

youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.

Thanks! Now the problem can be solved (cron does not see local bin's)

@dstftw dstftw closed this Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.