ryansheehan / terraria

Dockerfile for terraria
MIT License
294 stars 104 forks source link

-motd option #43

Closed revilofr closed 4 years ago

revilofr commented 4 years ago

Hi Ryan,

Thanks a lot for this Docker image. Working really fine for me. Anyway would it be possible to add a --motd option to have the possibility to provide our own motd file ?

Thanks a lot ! Have a great day !

ryansheehan commented 4 years ago

I believe there is a motd.txt file that gets created when you create a world. As long as you have the volume to docker setup for the world then you can update that file.

-v :/root/.local/share/Terraria/Worlds

On Fri, May 22, 2020 at 4:54 AM revilofr notifications@github.com wrote:

Hi Ryan,

Thanks a lot for this Docker image. Working really fine for me. Anyway would it be possible to add a --motd option to have the possibility to provide our own motd file ?

Thanks a lot ! Have a great day !

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ryansheehan/terraria/issues/43, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB46ER5VQ27NAOE2DODFTKLRSZDWJANCNFSM4NHUWD3Q .

revilofr commented 4 years ago

I did a script to update the file inside the container. It seams to work. The file is updated.

But the server doesn't seem to refresh. Anyway thx for you answer. I'll let you know if I figure how to do it :).

JackTGarland commented 4 years ago

Hi, I use podman but it is very similure to docker, I changed my MOTD by podman exec -it ID /bin/sh #replace podman with docker cd / cd world apt-get install nano nano motd.txt

Did not have to restart just opened terraria and it was changed.

revilofr commented 4 years ago

I suspect that the last update made 3 hours ago made the magic happend : here is my scripts :

update_motd.sh

`

!/bin/sh

CONTAINER_NAME="terraria" LOCAL_MOTD_PATH="$HOME/terraria/tshock" WORLDS_PATH="/root/.local/share/Terraria/Worlds" now=$(date '+%Y%m%d%H%M%s') motd_filename=$now-motd.txt

echo "Saving previous message of the day into $LOCAL_MOTD_PATH/$motd_filename..." docker cp $CONTAINER_NAME:$WORLDS_PATH/motd.txt $LOCAL_MOTD_PATH/$motd_filename echo "Updating the message of the day with the new one..." docker cp $LOCAL_MOTD_PATH/motd.txt $CONTAINER_NAME:$WORLDS_PATH/motd.txt echo "Message of the day has been updated"`

Then just make sure that the motd.txt file is here : $HOME/terraria/tshock And call it like that ./update_motd.sh

Thanks a lot, have a nice day !