Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is my sh-file:, that I use this to download youtube files in a specific period per day. when I drag the file ( into the terminal and press return key, it starts to download. but when I use the below command in crontab -e, Nothing happens!

00 21 * * * /home/deroot/links4dl/

Torify: wrapper for torsocks or tsocks and tor -> man torify

youtube-dl: download videos from or other video platforms -> man youtube-dl

share|improve this question
if any of those commands post output to the screen it is NOT going to work. I would ALWAYS reroute errors and notices to /dev/null 2>&1 – Rinzwind Jul 1 '13 at 12:01
Also, always use the full path when using crontab. That, or make sure that the shell running the script has the same $PATH variable as your interactive bash session. – January Jul 1 '13 at 12:08
And if you do not use an absolute path add $PATH to your crontab ;) example: – Rinzwind Jul 1 '13 at 12:10
Or, you can try redirecting the output to a file, so you can see the errors. So, you would do 00 21 * * * /home/deroot/links4dl/ > /home/deroot/ScriptLog – Alaa Ali Jul 1 '13 at 13:04
@Alaa 00 21 * * * /home/deroot/links4dl/ > /home/deroot/ScriptLog 2>&1 – Emmanuel Jul 1 '13 at 14:07
up vote 2 down vote accepted

Remember that Cron uses its own environment, which is different of your own environment.

If you didn't changed it, in cron environment $PATH is /usr/bin:/bin

You can check where your command are stored with that commands:

which torify 
which youtube-dl

if its not in /usr/bin:/bin => Add a minimal PATH environment into your script, something like:

export PATH="/bin:/usr/bin:xxxx"

(where xxxx is the path to your command )

share|improve this answer
note that @Rinzwind pointed that you can add the PATH to the crontab itself. – Emmanuel Jul 1 '13 at 18:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.