~nytpu/snep-bot

906f00c91d4b62b0bbbd4112f638a5b78e136210 — nytpu 5 months ago db670e8
updaet
1 files changed, 5 insertions(+), 3 deletions(-)

M snep-bot.go
M snep-bot.go => snep-bot.go +5 -3
@@ 85,13 85,13 @@ Snow leopards are one of the best animals, and I'm here to share them with you. 

	// do the final culminating posts
	// open old and new indexes
	geminiOrig, err := os.Open("/var/gemini/nytpu.com/sneps/index.gmi")
	geminiOrig, err := os.Open("/var/local/sneps/index.gmi")
	if err != nil {
		fmt.Println("Failed to open file: ", err)
		os.Exit(1)
	}
	defer geminiOrig.Close()
	geminiNew, err := os.OpenFile("/var/gemini/nytpu.com/sneps/index.gmi.new", os.O_RDWR|os.O_CREATE, 0666)
	geminiNew, err := os.OpenFile("/var/local/sneps/index.gmi.new", os.O_RDWR|os.O_CREATE, 0666)
	if err != nil {
		fmt.Println("Failed to open file: ", err)
		os.Exit(1)


@@ 125,7 125,7 @@ Snow leopards are one of the best animals, and I'm here to share them with you. 
		os.Exit(1)
	}
	// move new to old once writing is confirmed to have been successful
	err = os.Rename("/var/gemini/nytpu.com/sneps/index.gmi.new", "/var/gemini/nytpu.com/sneps/index.gmi")
	err = os.Rename("/var/local/sneps/index.gmi.new", "/var/local/sneps/index.gmi")
	if err != nil {
		fmt.Println("Failed to move file: ", err)
		os.Exit(1)


@@ 143,8 143,10 @@ Snow leopards are one of the best animals, and I'm here to share them with you. 
		os.Exit(1)
	}

	/*
	err = os.Rename(filename, fmt.Sprintf("/var/gemini/nytpu.com/sneps/D%03d.jpg", day))
	if err != nil {
		fmt.Printf("Failed to rename \"%v\": %v", filename, err)
	}
	*/
}