Find the answer to your Linux question:
Results 1 to 5 of 5
Hi there, I have, probably, a newbie question. I'm serving a Minecraft Server and managing it with msm (Minecraft Server Manager). With this program I'm able to do a few ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2013
    Posts
    6

    cronjob won't execute command correctly


    Hi there,

    I have, probably, a newbie question.

    I'm serving a Minecraft Server and managing it with msm (Minecraft Server Manager). With this program I'm able to do a few command.
    For example:
    Code:
    msm minecraft_server connected
    This command shows how many players are connected to my server.

    Now I wanted to write this to a Textfile:
    Code:
    msm minecraft_server connected > /var/www/minecraft_status/connected.txt
    If I'm executing this directly in the console, the file will be filled with the result.
    But if I'm trying to use this command to execute via cronjob, it won't write anything in the file. It just clears it.

    My crontab entry:
    Code:
    */5 * * * * msm minecraft_server connected > /var/www/minecraft_status/connected.txt
    If I execute the command with a user who doesn't have the rights to execute msm commands I will get the error message:
    This command must be executed as the user "minecraft" or "root"
    and the file "connected.txt" is cleared.

    I've entered the cronjob in the crontab for the user "minecraft" and for testing in the crontab for root via "sudo crontab -e"

    I don't know why it won't work via cronjob. Does anyone have an idea (and is see through this whole thing? ^^)?

    By the way, I'm using Ubuntu Server in Version 12.04.3

    Thanks in Advance!

  2. #2
    Just Joined!
    Join Date
    Aug 2009
    Location
    Mumbai, India
    Posts
    90
    Hi,

    When configuring it through cron, specify the complete path to msm command such that it reads
    Code:
    */5 * * * * /path_to_file/msm minecraft_server connected > /var/www/minecraft_status/connected.txt
    cron does not always detect the system ENV & PATH similar to that in bash prompt. Also check the cron error log in /var/log to see if it throws up any error

    --Syd

  3. #3
    Just Joined!
    Join Date
    Dec 2013
    Posts
    6
    Hey, thanks for the tip!
    Is there a way to determine the execution path for msm?
    It is not configured in ENV.

    Gesendet von meinem Nexus 4 mit Tapatalk

  4. #4
    Just Joined!
    Join Date
    Aug 2009
    Location
    Mumbai, India
    Posts
    90
    Hi,

    The command won't be set in ENV

    Either of the following commands should help find where the binary is located
    Code:
    locate msm
    find / -name msm -type f
    --Syd

  5. #5
    Just Joined!
    Join Date
    Dec 2013
    Posts
    6
    *sigh* sure... Locate of find.
    I should have known that

    The first tests say: That's was the answer. I get a correct result. It seems to be working now.

    Many many thanks for your effort and tips!

    Greetings
    The_Lux

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •