I'm experiencing some issues trying to call a bash script as a cronjob which just won't run.

Here's for eliminating some possible sources of failure:

  • I edited the cron via sudo crontab -e
  • The script is supposed to run every night at 4am so the command is 0 4 * * * bash ~/nightly_backup.sh
  • The script is located in /home/myuser/nightly_backup.sh
  • The script runs completely on its own and has no need for any user input
  • Calling it manually via sudo bash ~/nightly_backup.sh works just fine
  • There's another command in the crontab which is scheduled to run every 5 minutes and works fine as well (fswebcam -r ...)

What am I doing wrong?

In addition: looking up today if the script has run I see the syslog which says the following:

Feb  7 04:00:01 localhost CRON[7767]: (root) CMD (bash ~/nightly_backup.sh)
Feb  7 04:00:01 localhost CRON[7764]: (CRON) info (No MTA installed, discarding output)
Feb  7 04:00:03 localhost CRON[7765]: (CRON) info (No MTA installed, discarding output)
  • What does "no MTA installed, discarding output" mean?
  • Please don't ask multiple questions. The MTA message is just an infromation ("info") and is answered here but is not relevant to your problem. Feb 7, 2018 at 12:10

1 Answer 1


The basic problem seems to be: The use of ~ which refer to the home of the current user.

More details about the problem:

  • When you execute the command manually, the value of ~ is /home/myuser (myuser home)
  • When you execute the command using cron, the value of ~ is /root (root home)

Since the file isn't in /root/nightly_backup.sh cron can't execute it.



0 4 * * * bash ~/nightly_backup.sh


0 4 * * * /home/myuser/nightly_backup.sh

Note, you should make sure that the shell-script is execute-able, by running the following command (once):

chmod +x /home/myuser/nightly_backup.sh

Note: Regarding your other question

What does "no MTA installed, discarding output" mean?

It was answered here

In short: This happens because your cron jobs are producing output and then the cron daemon tries to email that output to you, while you don't have mail service installed in your system.

You can solve it by one of the following methods (more info in here)

  • Ignore the message
  • Install mail server
  • Redirect the cron job output into /dev/null
  • Redirect the cron job output into logger and you'll see it in syslog logs
  • 1
    well explained, thanks, that solved it! Can I just append a | logger after every echo command in my shell script?
    – tai
    Feb 7, 2018 at 12:03
  • 1
    @taiBsu - happy to help! I suggest to append the | logger at the end of the cron command as explained here
    – Yaron
    Feb 7, 2018 at 12:18
  • 1
    Thank you so much, I've been struggling with running the CRON job. Making it executable helped. Nov 23, 2022 at 14:52

You must log in to answer this question.

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