0

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:

SHELL=/bin/bash

* * * * * "/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):

HOME=/home/name
LOGNAME=name
PATH=/usr/bin:/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/home/name

Here is env from the shell:

PATH=/home/name/bin:/home/name/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

SHELL=/bin/bash

Not sure what I'm doing wrong.

EDIT:

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.

Sayaka
  • 11
  • 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 05: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 05: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 05: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 06:09