1 Commits

Author SHA1 Message Date
1371e0e637 reconfigure tools 2023-12-01 13:40:27 +11:00
28 changed files with 11 additions and 143 deletions

View File

@@ -1,8 +1,8 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian // README at: https://github.com/devcontainers/templates/tree/main/src/debian
{ {
"name": "Ubuntu Dev", "name": "Alpine Dev",
"image": "ubuntu-dev:user", "image": "alpine-dev:user",
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [

1
.gitignore vendored
View File

@@ -1,2 +1 @@
/target /target
/coba.txt

View File

@@ -5,19 +5,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "wmtest-helper-dummy"
path = "src/bin/test-helper/dummy.rs"
[[bin]]
name = "wmtest-helper-spawner"
path = "src/bin/test-helper/spawner.rs"
[[bin]]
name = "wmtest-helper-log"
path = "src/bin/test-helper/log.rs"
[dependencies] [dependencies]
anyhow = "1.0.75" anyhow = "1.0.75"
lazy_static = "1.4.0" lazy_static = "1.4.0"

View File

@@ -1,25 +0,0 @@
FROM rust:alpine as builder
ADD . /root/wingmate
WORKDIR /root/wingmate
RUN apk add musl-dev && cargo clean && \
cargo build --release
FROM alpine
COPY --from=builder /root/wingmate/target/release/wingmate-rs /usr/local/bin/wingmate
COPY --from=builder /root/wingmate/target/release/wmtest-helper-dummy /usr/local/bin/wmtest-helper-dummy
COPY --from=builder /root/wingmate/target/release/wmtest-helper-spawner /usr/local/bin/wmtest-helper-spawner
COPY --from=builder /root/wingmate/target/release/wmtest-helper-log /usr/local/bin/wmtest-helper-log
ADD docker/alpine/etc/ /etc/
ADD docker/alpine/entry.sh /usr/local/bin/entry.sh
RUN chmod -R ugo+x /etc/wingmate && chmod +x /usr/local/bin/entry.sh && apk add tzdata && \
ln -sv /usr/share/zoneinfo/Australia/Sydney /etc/localtime
ENTRYPOINT [ "/usr/local/bin/entry.sh" ]
CMD [ "/usr/local/bin/wingmate" ]

View File

@@ -1,7 +0,0 @@
#!/bin/sh
if [ $# -gt 0 ];then
exec "$@"
else
exec /usr/local/bin/wingmate
fi

View File

@@ -1,3 +0,0 @@
17 * * * * /etc/wingmate/crontab.d/cron1.sh
*/5 * * * * /etc/wingmate/crontab.d/cron2.sh
21,41 3,6,14,17,20,22 * * * /etc/wingmate/crontab.d/cron3.sh

View File

@@ -1,3 +0,0 @@
#!/bin/sh
exec wmtest-helper-log /var/log/cron1.log "this cron runs every hour on minute 17"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
exec wmtest-helper-log /var/log/cron2.log "this cron runs every hour on minute 5,10,15,20,25,30,35,40,45,50,55"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
exec wmtest-helper-log /var/log/cron3.log "this cron runs based on this specification: 21,41 3,6,14,17,20,22 * * *"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
exec sleep 1

View File

@@ -1,3 +0,0 @@
#!/bin/sh
exec sleep 1

View File

@@ -1 +0,0 @@
you cannot run this file

View File

@@ -1,9 +0,0 @@
FROM ubuntu:22.04
ADD target/debug/init /usr/local/bin/init
ADD docker/etc/ /etc/
RUN chmod ugo+x /etc/wingmate/services/one && chmod ugo+x /etc/wingmate/services/two.sh && \
chmod ugo-x /etc/wingmate/services/three.sh
CMD [ "/usr/local/bin/init" ]

View File

@@ -1,3 +0,0 @@
17 * * * * sleep 1
*/12 * * * * sleep 1
12,17,27 * * * * sleep 1

View File

@@ -1 +0,0 @@
you cannot run this file

View File

@@ -1,3 +0,0 @@
#!/bin/bash
exec sleep 1

View File

@@ -1,3 +0,0 @@
#!/bin/bash
exec sleep 1

View File

@@ -1,6 +1,6 @@
mod init;
use std::error; use std::error;
use wingmate_rs::init;
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), Box<dyn error::Error>> { async fn main() -> Result<(), Box<dyn error::Error>> {

View File

@@ -1,15 +0,0 @@
use std::{env, thread, time};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let myi: u64;
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
myi = args[1].parse().unwrap();
thread::sleep(time::Duration::from_secs(myi));
} else {
return Err(anyhow::anyhow!("invalid arguments").into());
}
Ok(())
}

View File

@@ -1,19 +0,0 @@
use std::env;
use std::fs;
use std::io;
use std::io::Write;
use time::OffsetDateTime;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = env::args().collect();
if args.len() == 3 {
let file = fs::OpenOptions::new().create(true).append(true).open(&args[1])?;
let mut buf = io::BufWriter::new(file);
let local_time = OffsetDateTime::now_local()?;
buf.write_all(format!("{} {}\n", local_time, &args[2]).as_bytes())?;
} else {
return Err(anyhow::anyhow!("invalid argument").into());
}
Ok(())
}

View File

@@ -1,17 +0,0 @@
use std::error::Error;
use std::process::Command;
use std::env;
fn main() -> Result<(), Box<dyn Error>> {
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
let x: u64 = args[1].parse()?;
for _i in 0..x {
// println!("spawning {}", _i);
Command::new("/usr/local/bin/dummy").arg("10").spawn()?;
}
} else {
return Err(anyhow::anyhow!("invalid arguments").into());
}
Ok(())
}

View File

@@ -75,11 +75,14 @@ pub enum CronConfigError {
#[error("setting day of week and day of month at the same time will lead to unexpected behavior")] #[error("setting day of week and day of month at the same time will lead to unexpected behavior")]
ClashingConfig, ClashingConfig,
// #[error("something went wrong")] #[error("when setting time for higher order, the smallest (minute) muste be set")]
// Other { MissingMinute,
// #[source]
// source: anyhow::Error, #[error("something went wrong")]
// } Other {
#[source]
source: anyhow::Error,
}
} }
#[derive(Error,Debug)] #[derive(Error,Debug)]