I currently have a shell script that I manage to execute without cron using 'sh runScript' to run it whilst in the same folder. It's located in my root folder. To try and get cron to run it at start-up I input:

@reboot sh runScript

into the file and saved it. I then did a reboot however I'm certain it isn't running. I tried doing @reboot echo "hello world" and that also did not execute correctly. I feel like this has something to do with paths. Any suggestions?

EDIT: I should probably mention I'm using Alpine. I have also changed the top line of my script to be #!/bin/sh now instead of #!/bin/bash so that I can run it using the filename.

  • 1
    If it has something to do with paths then why don't you just specify the path? Commented Nov 22, 2017 at 22:31
  • @IgnacioVazquez-Abrams I don't think it's the path any more.
    – WewLad
    Commented Nov 22, 2017 at 22:42
  • How do you know your echo didn't work? Did you check your local mail? Commented Nov 22, 2017 at 22:43
  • @IgnacioVazquez-Abrams Local mail? I know the original command didn't work because when I run it manually I usually see the process in 'top' however when I use cron it won't be there.
    – WewLad
    Commented Nov 22, 2017 at 22:45
  • 1
    echo doesn't usually take long enough to hang around in the process list. Commented Nov 22, 2017 at 22:46

1 Answer 1


Check your cron log if there was any try to run the script. On redhat it is usually /var/log/cron. If there is error with path, you will see it there (what actually cron tried to run).
Then, to double check, instead of trying echo, try to send anything to a file, for example date > /file_with_date.txt. Then check if the file was created and what time is in it.
Then check if cron daemon runs at all ;)
Then check rights on the file, execute bit, maybe selinux blocks access to it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .