0

First- I've already scoured this page and nothing has worked.

My script will create a file, this is how I know if it has run or not. /var/log/syslog isn't giving me any debugging information. Below is my crontab section, below what's already there by default:

SHELL=/bin/bash

# Check for minecraft server updates
* * * * * root minecraft_update > /tmp/cron.out

# TEST
* * * * * root env > /tmp/env.out

Note: there is a blank line at the end of the crontab file. I specified the bash shell even though that is specified in my script. My script (minecraft_update) lives in the /usr/local/bin directory, and the only other commands it calls are grep, ls, and head, which are all in the /bin dir, which is already defined in the crontab PATH.

The /tmp/cron.out file is created, but empty. The /tmp/env.out file is created and confirms that the PATH includes both the /usr/local/bin and /bin dirs, and also confirms the SHELL=/bin/bash.

Addtl. perms info:

ll /etc/crontab
-rw-r--r-- 1 root root 998 Jul  1 12:47 /etc/crontab

ll /usr/local/bin/minecraft_update
-rwxr--r-- 1 root root 1132 Jul  1 12:31 minecraft_update*

I'm so frustrated with this! Please bring an end to my * * * * * misery... [That's cron notation, not profanity btw. Gotta love Linux humor :)]

Willman
  • 233

1 Answers1

1

You don't need 'root' in the crontab listing, (unless you have a program root that you are using to run your script).

If ypu are editing your crontab with sudo crontab -e (/var/spool/cron/crontabs/root), then you do not need a username. If you are editing the system-wide crontab (/etc/crontab), then you do need a username listed.

E.x.

sudo crontab -e

SHELL=/bin/bash

# Check for minecraft server updates
* * * * * minecraft_update > /tmp/cron.out

# TEST
* * * * * env > /tmp/env.out

OR nano /etc/crontab

SHELL=/bin/bash

# Check for minecraft server updates
* * * * * root minecraft_update > /tmp/cron.out

# TEST
* * * * * root env > /tmp/env.out

Source