prepare for v0.3.0
This commit is contained in:
12
web/cron.sh
12
web/cron.sh
@@ -18,9 +18,9 @@ login() {
|
||||
|
||||
# Check if login was successful (look for "200 OK" in response headers)
|
||||
if [ $? -eq 0 ] && [ "$(echo "$response" | grep -c "token")" -eq 1 ]; then
|
||||
echo "Login successful. Cookie obtained."
|
||||
echo "$(date +"%T"): Login successful. Cookie obtained." > /proc/1/fd/1
|
||||
else
|
||||
echo "Login failed. Unable to obtain cookie."
|
||||
echo "$(date +"%T"): Login failed. Unable to obtain cookie." > /proc/1/fd/1
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -36,16 +36,16 @@ upload_and_delete() {
|
||||
|
||||
# Check if API call was successful (status code 200)
|
||||
if [ $? -eq 0 ] && [ "$(echo "$response" | grep -c "author")" -eq 1 ]; then
|
||||
echo "File $file uploaded successfully."
|
||||
echo "$(date +"%T"): File $file uploaded successfully." > /proc/1/fd/1
|
||||
# Delete the file
|
||||
rm "$file"
|
||||
echo "File $file deleted."
|
||||
else
|
||||
echo $response
|
||||
echo "Failed to upload file $file."
|
||||
echo "$(date +"%T"): Failed to upload file $file." > /proc/1/fd/1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "$(date +"%T"): Starting auto-upload" > /proc/1/fd/1
|
||||
# Login to obtain cookie
|
||||
login "$USERNAME" "$PASSWORD"
|
||||
|
||||
@@ -56,3 +56,5 @@ for file in "$UPLOAD_FOLDER"/*; do
|
||||
upload_and_delete "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$(date +"%T"): Auto-upload completed" > /proc/1/fd/1
|
||||
|
||||
Reference in New Issue
Block a user