I've checked this link for suggestions but I can't seem to get a .sh script working. I'm new to Ubuntu and Linux (from Windows).

Why crontab scripts are not working?

Here is the dummy .sh I'm testing.

It's called testing.sh

#! /bin/bash

ls > testing.txt

Here is how my crontab looks like:


* * * * * "/home/name/Desktop/Instragram Scraper/Instagram looter/batch_scripts/testing.sh"

* * * * * "/home/name/Desktop/Instragram Scraper/Instagram looter/batch_scripts/daily_0.sh"

 ****other randoms cron jobs******

I've looked at the environmental paths for cron as well as the shell and but it seems they have variables in common so I'm assuming PATH is not a problem?

Here is Crontab's environmental variables (so I tried changing the shell command by adding it to the top of the cron file):


Here is env from the shell:



Not sure what I'm doing wrong.


It seems the text files are being created under HOME, so I was looking at the wrong place. However when running a real (not dummy) cron command, the cron command doesn't seem to be running these commands from my .sh script:

"instalooter hashtag "donut" "/media/name/data/" -n 100 -j 2 --new"

basically the instalooter command doesn't seem to be running,

which if I run via the cmd line or if I run the same script via command line, those commands have no problem being ran.

Is this an variable problem?

Thank you.

  • 1
    1. No space after #! 2. Try without spaces in filename 3. Make sure script path is absolutely correct and executable – qwr Nov 14 '18 at 5:07
  • You can change the path to "/home/name/Desktop/Instragram\ Scraper/Instagram looter/batch_scripts/testing.sh" after you fixing your path in the test script the file will be created in the home directory of the user running the cron – Manula Waidyanatha Nov 14 '18 at 5:21
  • @ManulaWaidyanatha Ah, I see. I though it would be created in the directory of the .sh file. I see the text files being created. However, the crontab is not running the non-dummy commands "instalooter hashtag "donut" "/media/name/data/" -n 100 -j 2 --new" I've updated the OP. – Sayaka Nov 14 '18 at 5:56
  • @Sayaka what is the instalooter path edit your script and give the full path to the command. You can get the full path by which instalooter. – Manula Waidyanatha Nov 14 '18 at 6:09

You need to get a clear error message in order to solve this, although this appears to be a PATH variable problem(in such case you might need to concatenate path of your program to crontab PATH variable)

To get a clear error message from your command you need to redirect Standard Error Stream of the command to Standard Output Stream and redirect it to a file's input stream this can be achieved with 2>&1 operator, where the numbers represent file descriptors(wont go into details here).

command args > /debug.txt 2>&1

After modifying the the script once the crontab executes your script, you can look at debug.txt for error messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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