Updated Scheduling exports with Mono & Crontab (markdown)

Yudi
2018-09-13 17:24:01 -03:00
parent cd987dad60
commit ff9659ee48

@@ -1,4 +1,8 @@
Make sure you already have DiscordChatExporter and Mono properly installed ([instructions here](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Linux-usage-instructions)):
Make sure you have DiscordChatExporter and Mono properly installed ([instructions here](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Linux-usage-instructions)).
You can use Crontab on macOS, but [this method](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Scheduling-exports-on-macOS) is preferred.
#
**1.** Open Terminal, create a new script with `sudo nano /path/to/DiscordChatExporter/cron.sh`
@@ -6,7 +10,8 @@ Make sure you already have DiscordChatExporter and Mono properly installed ([ins
```
#!/bin/bash
# Info: https://github.com/Tyrrrz/DiscordChatExporter
# Info: https://github.com/Tyrrrz/DiscordChatExporter/wiki
TOKEN=<token>
TOKENTYPE=<BOT/USER>
CHANNEL=<channel>
@@ -22,8 +27,11 @@ if [[ "$TOKENTYPE" == "BOT" ]]; then
ISBOTYES=-b
fi
PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
mono DiscordChatExporter.Cli.exe -t $TOKEN $ISBOTYES -c $CHANNEL -f $EXPORTFORMAT -o exporttmp
CURRENTTIME=`date +"%Y-%m-%d-%H-%M-%S"`
if [[ "$EXPORTFORMAT" == "PlainText" ]]; then
mv "exporttmp" $EXPORTDIRECTORY/$FILENAME-$CURRENTTIME.txt
@@ -42,7 +50,7 @@ exit
`<token>` with your [Token](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
`<BOT/USER>` If the Token is from a bot replace it with `BOT`, if it's from a user, `USER`.
`<BOT/USER>` If the Token is from a bot replace it with `BOT`, if it's from a user, `USER`
`<channel>` with a [Channel ID](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs)
@@ -52,13 +60,13 @@ exit
`<dir>` with the export directory without quotes (e.g. /home/user/Documents/CronExport)
`<format>` with one of the available export formats.
`<format>` with one of the available export formats
**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`
**6.** Add `* * * * * /path/to/DiscordChatExporter/cron.sh` to the end of the file.
**6.** Add `* * * * * /path/to/DiscordChatExporter/cron.sh >/tmp/discordexporter.log 2>/tmp/discordexportererror.log` to the end of the file
Replace the *s according to:
@@ -71,6 +79,8 @@ Week starts on Sunday. 0 = SUN, 1 = MON...
Filename date format is YYYY-MM-DD-hh-mm-ss.
The cron file is located at `/usr/lib/cron/tabs` on macOS, and at `/var/spool/cron/crontabs` on Linux, but should always be edited with `crontab -e`.
#
**Examples**