made all errors verbose
This commit is contained in:
parent
c0b134b9a0
commit
87ca81c18a
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
mastodon-image-uploader-bot >./tmp/log.out 2>./tmp/log.err
|
||||||
|
if [ ! -s ./tmp/log.err ]; then
|
||||||
|
echo -n "$(date +"[%Y-%M-%d %T]") success: " >> ./bot.log
|
||||||
|
cat ./tmp/log.out >> ./bot.log
|
||||||
|
else
|
||||||
|
echo -n "$(date +"[%Y-%M-%d %T]") errors: " >> ./bot.log
|
||||||
|
cat ./tmp/log.err >> ./bot.log
|
||||||
|
fi
|
12
src/main.rs
12
src/main.rs
|
@ -78,8 +78,8 @@ fn get_next_url(config: &Config) -> Option<String> {
|
||||||
.write(true)
|
.write(true)
|
||||||
.append(true) // This is needed to append to file
|
.append(true) // This is needed to append to file
|
||||||
.open(&config.files.posted)
|
.open(&config.files.posted)
|
||||||
.unwrap();
|
.expect("Cannot open posted file"); // Maybe we should retry just in case
|
||||||
write!(file, "{}\n", urls[0]).unwrap();
|
write!(file, "{}\n", urls[0]).expect("Cannot write to posted file"); // maybe we should retry tbh
|
||||||
Some(urls[0].to_string().clone())
|
Some(urls[0].to_string().clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,8 @@ async fn post_image(account: &Mastodon, url: &String, config: &Config) {
|
||||||
.visibility(Visibility::Unlisted)
|
.visibility(Visibility::Unlisted)
|
||||||
.sensitive(true)
|
.sensitive(true)
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.expect("Could not build status"); // we should retry
|
||||||
account.new_status(status).await.expect("Error generating status");
|
account.new_status(status).await.expect("Error generating status"); // we should retry or delete last url in posted
|
||||||
println!("Status posted")
|
println!("Status posted")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,9 +127,9 @@ async fn update_bio(account: &Mastodon, config: &Config) {
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.expect("Could not spawn curl")
|
||||||
.wait()
|
.wait()
|
||||||
.unwrap();
|
.expect("Curl failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn post(account: &Mastodon, msg: &str) {
|
async fn post(account: &Mastodon, msg: &str) {
|
||||||
|
|
Loading…
Reference in New Issue