Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# A script to update an RSS feed when player events happen in minecraft server log.
# Integrate with IFTTT or other RSS reader tools to get live alerts.
# For now, just monitors player join/leave events.
# Only keeps last 10 entries in RSS file (rotating out oldest ones).
# Requires: xmlstarlet, perl, uuidgen, and other typical Linux commands.
# Does not manage pid file.
# Cron example (run daily as user specific to this process - not as user who otherwise runs tail)
@calebjones
calebjones / clean-daily-backups.sh
Last active December 12, 2017 17:50
Linux script to rotate backup files (keeps past 7 days then switches to weekly for the past 30 days then keeps only monthly files)
#!/bin/bash
# backup location with daily files
# format: .*_[DATE]_.*
# date format: YYYY-MM-DD
backupLocation="/path/to/backups"
if [ -z "$backupLocation" ]; then
echo 'Must set $backupLocation'
exit 1
@calebjones
calebjones / minecraft
Last active December 12, 2017 17:46
Linux script to manage minecraft server
#!/bin/bash
### BEGIN INIT INFO
# Provides: minecraft
# Required-Start: $local_fs $remote_fs screen-cleanup
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Minecraft server
@calebjones
calebjones / minecraft-crontab
Created August 14, 2015 19:28
Linux Minecraft server crontab config
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
# backup server every day at 4am
0 4 * * * /home/minecraft/minecraft/bin/minecraft backup
# clean daily backups (keep daily last 7 days, weekly for last 30 days, then once a month)
30 4 * * * /home/minecraft/clean-daily-backups.sh
@calebjones
calebjones / backup-minecraft.sh
Created July 10, 2015 17:58
Change-aware Minecraft backup script
#!/bin/bash
dateStr="`date +"%Y%m%d%H%M"`"
fileNamePrefix="name-of-backup"
tarFileName="${fileNamePrefix}-${dateStr}.tgz"
#echo "tarFileName: ${tarFileName}"
cd "/Users/USERNAME/Library/Application Support/minecraft"
lastBackupFile=`ls -rt | grep $fileNamePrefix | awk 'NR==0; END{print}'`
@calebjones
calebjones / gist:a7b6f977eb1bfe67f27e
Created April 11, 2015 16:02
onename-verification
Verifying that +calebjones is my openname (Bitcoin username). https://onename.com/calebjones