]> us-delaporte.pagekite.me Git - dotfiles.git/blobdiff - invoke/minecraft-remote/tasks.py
Add esptool
[dotfiles.git] / invoke / minecraft-remote / tasks.py
index 6f3dbd17f8758bf083a99cc4a676b9649b8e5697..2d253b3fa480d6d12c220656fae78e447112301f 100644 (file)
@@ -21,11 +21,18 @@ LOCAL_BACKUPS=f'{LOCAL_HOME}/backup/minecraft'
 
 MINECRAFT=f'{HOME}/Minecraft'
 
-dims = ['world', 'world_nether', 'world_the_end']
+DIRS = ['world', 'world_nether', 'world_the_end', 'plugins']
+
+# TODO: Set these
+JAVA=f'{HOME}/java/jdk21/bin/java'
+JAVA_OPTS=f'-Xms3g -Xmx7g'
+OPTIONS=f'--nogui'
+
+SERVE=f'screen -S Minecraft -d -m {JAVA} {JAVA_OPTS} -jar {MINECRAFT}/server.jar {OPTIONS}'
 
 @task
 def compress_world(c):
-    for world in dims:
+    for world in DIRS:
         c.run(f'{SSH} -C tar cf /tmp/{world}.{DATE_TAR} --directory={MINECRAFT} {world}')
     c.run(f'{SSH} -C ls /tmp | grep .tar')
 
@@ -38,7 +45,7 @@ def backup(c):
         exit()
     c.run(f'mkdir -p {LOCAL_BACKUPS}')
 
-    for world in dims:
+    for world in DIRS:
         c.run(f'{SCP}:/tmp/{world}.{DATE_TAR} {LOCAL_BACKUPS}')
 
     c.run(f'ls -lh {LOCAL_BACKUPS} | grep .tar')
@@ -46,7 +53,7 @@ def backup(c):
 
 @task
 def verify_backup(c):
-    for world in dims:
+    for world in DIRS:
         c.run(f'tar tvf {LOCAL_BACKUPS}/{world}.{DATE_TAR} | tail')
         c.run(f'tar tvf {LOCAL_BACKUPS}/{world}.{DATE_TAR} | wc')
 
@@ -61,3 +68,11 @@ def serve(c):
     print(f'Server should now be running in a remote screen session.')
     print(result)
 
+
+@task
+def serve(c):
+    print(f"Attempting to connect to {IP}")
+    result = c.run(f'ssh {USER}@{IP} -C {SERVE}')
+    print(f'Server should now be running in a remote screen session.')
+    print(result)
+