Not logged in - Login / Register
View History

Advanced McMyAdmin Scheduler Usage

About the Scheduler

McMyAdmin features an internal scheduler that allows you to perform operations at specific times, at regular intervals, or in response to certain events.

When multiple events are scheduled for the same time, they will run one after another in the order they appear in the list. Some tasks however are asynchronous (other tasks can run while they are working) - for example the scheduled task to Stop the server.

This means that if you have scheduled tasks to stop the server, and then another to start the server before it has finished stopping - it won't restart. As such you must use the 'restart' event.

For the most part the scheduler is straight forward and self explanatory. So this will mostly focus on advanced features.

Using Executables

The McMyAdmin scheduler can run or redirect executables or scripts as an event. In order to do so, the following conditions must be met:

  • The Security.AllowExec setting in McMyAdmin.conf must be enabled.
  • The script/executable must exist within the Exec directory where McMyAdmin is installed.
  • In the case of bash scripts, it must have a valid shebang (such as #!/bin/sh) on the first line, and must be flagged as executable via chmod +x.

Note that under Windows, the scheduler cannot run Batch files (.bat) as Windows doesn't treat them as real executables. There are however tools that can make proper executables from batch files to allow this to work.

Redirection

If an executable/script is redirected rather than simply executed, this means that any output generated will be fed to the input of the Minecraft server rather than simply discarded.

For example if you redirected the following bash script:

#!/bin/sh
echo say Hello Everyone! Today is $(date +"%A")
exit

Any in-game players would see a message including the current day.

Parameters

When a task is run in response to an event (rather than being a certain time) - some events will supply information as arguments. For executables they're passed as arguments, for functions (such as say a message) they can be used in-line by putting a {0} in the data field.

  • Completed backups will supply the filename of the backup.
  • When a player joins or leaves, the name of the player that joined is passed.
  • When a user logs into the control panel, the username of the user that logged in is supplied.

Modified groups will supply one of the following series of arguments describing the operation:

--creategroup GROUPNAME
--erasegroups
--renamegroup OLDNAME:NEWNAME
--removegroup GROUPNAME
--addworld GROUPNAME:WORLDGUID
--removeworld GROUPNAME:WORLDGUID
--addcommand GROUPNAME:COMMAND
--removecommand GROUPNAME:COMMAND
--addmember GROUPNAME:USER
--removememver GROUPNAME:USER

For example, if you had a scheduled task that ran whenever a user logged into the admin panel, and the task was to say a message of {0} has logged into the control panel - then in-game players would see who just logged in.