diff --git a/gotosleep.sh b/gotosleep.sh new file mode 100644 index 0000000..980ba90 --- /dev/null +++ b/gotosleep.sh @@ -0,0 +1,3 @@ +#! /bin/bash + +ssh root@192.168.0.22 shutdown now \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index def8965..6c4cbdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,12 +12,12 @@ async fn index(name: web::Path) -> Result { name: name.to_string(), }; - let mut sleep_command = Command::new("ssh root@192.168.0.22 shutdown now"); + let mut sleep_command = Command::new("gotosleep.sh"); let name = name.to_string(); if name == "penis" { - sleep_command.status().expect("failed to shutdown serwer"); - } + sleep_command.status().expect("failed to send command"); + } Ok(web::Json(obj)) } @@ -26,7 +26,7 @@ async fn main() -> std::io::Result<()> { use actix_web::{App, HttpServer}; HttpServer::new(|| App::new().service(index)) - .bind(("192.168.0.10", 2137))? + .bind(("0.0.0.0", 2137))? .run() .await } \ No newline at end of file