41 lines
1.1 KiB
Kotlin
41 lines
1.1 KiB
Kotlin
@file:JvmName("Main")
|
|
package eu.heili.hometheater
|
|
|
|
import eu.heili.hometheater.basicutils.Info
|
|
import eu.heili.hometheater.basicutils.Log
|
|
import eu.heili.hometheater.db.JDBC
|
|
import eu.heili.hometheater.website.Webserver
|
|
import java.io.IOException
|
|
|
|
fun main() {
|
|
Log.setLevel(Log.DEBUG)
|
|
Info.init()
|
|
|
|
Log.info("startup of Home-Theater")
|
|
|
|
Runtime.getRuntime().addShutdownHook(Thread(Runnable {
|
|
try {
|
|
Thread.sleep(200)
|
|
Log.warning("Shutting down ...")
|
|
//shutdown routine
|
|
} catch (e: InterruptedException) {
|
|
e.printStackTrace()
|
|
}
|
|
}))
|
|
|
|
Log.info("Server version: " + Info.getVersion())
|
|
Log.debug("Build date: " + Info.getBuilddate())
|
|
|
|
//initial connect to db
|
|
Log.message("initial login to db")
|
|
try {
|
|
JDBC.init("todo", "todo", "todo", "todo.heili.eu", 3306)
|
|
} catch (e: IOException) { //e.printStackTrace();
|
|
Log.error("no connection to db")
|
|
}
|
|
|
|
|
|
//startup web server
|
|
val mythread = Thread(Runnable { Webserver().startserver() })
|
|
mythread.start()
|
|
} |