Toto je starší verze dokumentu!
Startup script
brandonuv startup script je infinite loop:
while true do blabla done
proto bude lepsi udelat klasicky startup.sh s podminkama zda mtserver bezi, nic nedelat jinak zalohovat a cronem hlidat ten script
(17:24:24) Pitriss: Ritchie_: BTW v cronu se hodí ěnco ve stylu:
'' */5 * * * * minetest if [ `ps -e | grep -c minetestserver` = '0' ]; then /usr/local/bin/minetest_start.sh; fi ''
- minetest_start.sh
#!/bin/bash #This script is used to keep minetestserver running if it crash or stops. Also does backups and creates world map. ### config section #patch to world WORLD="/opt/minetest/world/classic_technic_game/" #patch to backup directory BACKUP="/opt/minetest-data/world-backups/" #patch to maps directory MAP="/opt/minetest-data/maps/" ### end of config section #variable which returns today's date and time in format for example 27102013_21:04:06 NOW="$(date +%d%m%Y_%T)" #name of world NAME="$(echo "$WORLD" | awk 'BEGIN { FS = "/" } {print $(NF-1)}')" #patch to minetest/world/ MT_WORLD="$(echo "$WORLD" | awk 'BEGIN { FS = "/"; OFS = "/" } {$(NF-1)=""; print$0}' | rev | cut -c2- | rev)" #debug of variables echo WORLD $WORLD echo BACKUP $BACKUP echo MAP $MAP echo NOW $NOW echo NAME $NAME echo MT_WORLD $MT_WORLD