Skip to content

Instantly share code, notes, and snippets.

@pjz
Last active October 7, 2023 18:41
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pjz/94f4bd81a0897fd64db44593078e2156 to your computer and use it in GitHub Desktop.
Save pjz/94f4bd81a0897fd64db44593078e2156 to your computer and use it in GitHub Desktop.
#!/bin/bash
# based on https://github.com/victorcoder/dkron/issues/212
#dkron_url="http://localhost:8080"
dkron_url=$1
if [ -z "$dkron_url" ]; then
echo "Usage: $0 <dkron base url>"
exit 1
fi
curl -s -X GET "$dkron_url/v1/jobs" -H "accept: application/json" -o -
echo
#!/bin/bash
# based on https://github.com/victorcoder/dkron/issues/212
dkron_url=$1
dkron_backup=$2
if [ -z "$dkron_url" -o -z "$dkron_backup" ]; then
echo "Usage: $0 <dkron base url> <dkron backup filename>"
exit 1
fi
LENGTH=$(jq length $dkron_backup)
for (( i=0; i<$LENGTH; i++ ))
do
echo "=== JOB $i ==="
jq ".[$i]" $dkron_backup
echo "-- result --"
jq ".[$i]" $dkron_backup | curl -sX POST "$dkron_url/v1/jobs" -H "accept: application/json" -H "Content-Type: application/json" -d @- | jq .
done
@sanroll
Copy link

sanroll commented Oct 6, 2023

Hi, how are you?
I have a problem importing my jobs on a new version of dkron.
I have the backup and this is ok, but when try to put on dkron v3 give me this error:

-- result --
parse error: Invalid numeric literal at line 1, column 10

Any idea?
Thx

@pjz
Copy link
Author

pjz commented Oct 7, 2023

sorry, I don't use dkron anymore, so am not familiar with the newer versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment