diff --git a/Scheduling-exports-with-Mono-&-Crontab.md b/Scheduling-exports-with-Mono-&-Crontab.md index 54106ad..dfb77d5 100644 --- a/Scheduling-exports-with-Mono-&-Crontab.md +++ b/Scheduling-exports-with-Mono-&-Crontab.md @@ -20,6 +20,7 @@ FILENAME= EXPORTDIRECTORY= EXPORTFORMAT= # Available export formats: PlainText, HtmlDark, HtmlLight, Csv +# /\ CaSe-SeNsItIvE /\ cd $EXEPATH || exit @@ -29,21 +30,25 @@ fi PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin -mono DiscordChatExporter.Cli.exe export -t ${TOKEN//\"} $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o exporttmp -CURRENTTIME=`date +"%Y-%m-%d-%H-%M-%S"` +mono DiscordChatExporter.Cli.exe export -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o export.tmp +CURRENTTIME=$(date +"%Y-%m-%d-%H-%M-%S") if [[ "$EXPORTFORMAT" == "PlainText" ]]; then - mv "exporttmp" ${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt + mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.txt" elif [[ "$EXPORTFORMAT" == "Html"* ]]; then - mv "exporttmp" ${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html + mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.html" elif [[ "$EXPORTFORMAT" == "Csv" ]]; then - mv "exporttmp" ${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv + mv "export.tmp" "${EXPORTDIRECTORY//\"}/$FILENAME-$CURRENTTIME.csv" else -exit +echo "$EXPORTFORMAT - Unknown export format" +if ! rm -Rf "export.tmp" ; then +echo "Unable to delete $PWD/export.tmp" fi -exit +exit 1 +fi +exit 0 ``` **3.** Replace: @@ -58,10 +63,12 @@ exit `` with a filename without spaces - `` with the export directory (e.g. /home/user/Documents/CronExport) + `` with the export directory (e.g. /home/user/Documents/Discord\ Exports) `` with one of the available export formats +**Remember to escape spaces** (add `\` before spaces)!

+ **4.** Give the shell script permissions with `sudo chmod 755 /path/to/DiscordChatExporter/cron.sh` **5.** Add a new job to crontab using `sudo crontab –e`