Scheduling console commands


#1

Okay, I’ve done multiple Google searches, and searched every scheduling related thread on this site as well, and not found quite what I need to get me over this hump. I have set up a server restart schedule, and all works great. I also have an archive/restore point schedule set up and that all works great as well. What I’m trying to do is to schedule a tellraw command so I can give the text a different color so my players notice it. I’ve tried to set this up under the scheduling tab just like my other tasks, and no matter how I put the text in, the server just tells me ‘Unknown command. Type /help…’ when the schedule kicks off the task. I’ve tried simpler commands as a test as well, such as ‘say Hello’ or ‘/say Hello’ and the result from the scheduled task is always as I described… ‘Unknown command’.

So my question is, what am I doing wrong? Is there a specific format I need to use to set up a simple tellraw command using the ‘Send to console’ option on the Scheduling page? I’m really not doing anything complicated with the tellraw, just simply using a gold text (not even bolding the text) for all but the last message at 1 minute prior to a restart, and that one is just as simple with just dark_red text color.


#2


This is what it should look like, Send to console sends exactly what is in the Additional argument field to console, exactly as is. An example of what you could put into that field would be “say Hello” (without the “/” and without the parenthesis). Also it may help to check logs as it logs the commands that are input into the console how they are input into the console (so if something is being put in incorrectly you’d see it). Unknown command would typically mean something about the command is incorrect, so a log would help us to help you; I don’t know about the tellraw command and there seems to be lack of detail on it from lightly researching it, but I’m used to plugins like the Essentials family/bundle of plugins that let you use color in the say command as well as in other places like chat.

Based upon this that I found and read however, tellraw is not what you want or at least it does not seem to be what you want.

Syntax
    tellraw <player> <raw json message>

Arguments
    player
        Specifies the player(s) to send the message to. Must be a player name or target selector.

    raw json message
        Specifies the message to send. Must be valid raw JSON text (for example, {"text":"Hi there!","bold":true}).

Arguments - player - Specifies the player(s) to send the message to. Must be a player name or target selector.


Edit: perhaps maybe try these out and see how they go?

1: “tellraw @p ["",{"text":"JayMontana36's tellraw Sample Test Command 1","color":"red","bold":true,"italic":true,"underlined":true}]

2: “tellraw @p ["",{"text":"JayMontana36 tellraw Sample Test Command 2","color":"red","bold":true,"italic":true,"underlined":true}]


#3

First, thanks for the reply. Thanks for clarifying that the send to console sends exactly what’s in the additional argument. That’s what I thought happened, and as far as the tellraw, as it says you send it to a player or a target selector, which can be @a to send to all players. As for the format, here is what I had in the scheduled event.

/tellraw @a {“text”:“This server will restart in 10 minutes!”,“color”:“gold”}

It doesn’t get much more simple than that for a tellraw command, other than to do away with the color. I’ve tried it with and without the leading forward slash, and the console simply says ‘Unknown command…’ in response. I even tried to simplify and just use the /say command and get the same error. This is why I started this thread, because what you said is what I thought was the case, and so I don’t really understand what’s happening.


#4

Well, I did some more searching and it looks like my JSON syntax was incorrect. I’ve corrected it to:

/tellraw @a ["",{“text”:“This server will restart in 10 minutes!”,“color”:“gold”}]

I am at work so can’t get in MC and get on the world right now to make sure the message is showing, but I didn’t see any errors this time. However, this still doesn’t explain why this:

/say This server will restart in 10 minutes!

was generating errors. Strange.


#5

So I did set up a dummy scheduled tellraw using the above JSON format. I quickly jumped on the server, and even though it didn’t create an error, it also didn’t display in chat.


#6

Well, you definitely do not want to have the “/” when it comes to executing commands in or via console, as console automatically precedes all entries with said “/” so by entering something such as “/say Hello” into console it will be treated as being “//say Hello” which is and will be both an incorrect and unknown command; you will only ever need that “/” in-game or in some very specific other scenarios.

Also, again the server’s log file (latest.log) would really almost definitely come in handy here in ensuring that MineOS is passing on what’s in those fields both exactly as is and complete in whole, so that we can at least eliminate that although the fact that you get “Unknown command” means that it is being passed but I’m curious if “special characters” also pass correctly, though they should.

You may also try manually entering the command into console (via the WebUI or via the terminal) and/or trying the command in-game. A thing you could do is test out commands to see how they work (helps with making sure they work and optimizing them to be perfect or exactly how you want them to be) followed by pasting them in afterwards.



#7

As I said, I tried with and without the leading slash with the same results.

Thank you, but no luck.

As I said, @a is a target selector to target all players, so should work just fine.

This must be an issue with some characters that are being passed. The latest.log file doesn’t show any info about the attempts to send a tellraw command, even directly via the console. For now I have a simple /say command working. I had to take out all punctuation to make it work, but the following is working:

say WARNING The server will restart in 5 minutes

I would much prefer to use the tellraw or even the title command to do this. I just need to figure out how to make it work. For now, the say command is working and will do the trick until I can figure out one of these options. Thanks for the help!


#8

Alright, @hexparrot after doing some investigation of my own, this issue seems to likely be with the screen command/program, not sure if it has anything to do with the MineOS Web UI passing stuff to it or if it’s a command problem/issue such as where in bash certain characters will split a line of command into multiple individual commands (I don’t remember all of those characters are though).

Anyways, here’s what results from each whenever the Web UI attempts to run these cron jobs (oh and ps btw I’ve replaced the @p with @a in these):

-X: Missing ' quote.

Now this is a pretty simple one, caused by the “JayMontana36's” portion of it, probably fixable by making it be “JayMontana36''s” instead.

-X: stuff: no, one or two argument required

Now this I’m unsure about, though seeing stuff makes me think that it may actually have something to do with the Web UI, though could also just be screen.

Now as for attempting to just paste it in directly through screen via the terminal, that doesn’t work either, instead just causing sort of a lock up though not really, it gives you this thing where you can keep on entering commands on separate lines, like you were wanting to download multiple files through one command or enter multiple lines in one command, at least when it comes to the first; the second however seems as if it glitches for a sec when you paste it in and then if you hit enter continuously won’t enter it but instead will keep on adding/spamming oM for as long as you’re pushing enter for, and then after enough will end up back to the multiple line thing again. Attempting to break from it of course shuts down the server, but there’s no real other way back to using console from terminal. Also the oM seems to correspond with how much the WebUI sends (or at least attempts to send) the command, though probably irrelevant.

Based on my findings, it is not at all even reaching the console, though it doesn’t seem to be the Web UI’s fault overall, however I personally have no idea at this point; I just have a feeling it lies somewhere between the WebUI and the screen program/command, since everything still works even with console being/getting stuck and jammed up (server doesn’t crash or anything).