forked from crawl/dgamelaunch-config
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup-cron.sh
More file actions
executable file
·46 lines (34 loc) · 1.77 KB
/
setup-cron.sh
File metadata and controls
executable file
·46 lines (34 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Define the commands and their schedules
command1="env - \$(cat /proc/1/environ | tr '\\0' '\\n') /home/crawl-dev/dgamelaunch-config/bin/dgl update-trunk >> /home/crawl-dev/logs/trunk.log 2>&1"
schedule1="*/15 * * * *"
command2="/home/crawl-dev/dgamelaunch-config/bin/dgl update-gcc stoatsoup stoatsoup/master >> /home/crawl-dev/logs/stoatsoup.log 2>&1"
schedule2="0 6 * * *"
command3="/home/crawl-dev/dgamelaunch-config/bin/dgl update-gcc bcadrencrawl bcadrencrawl/bCrawl >> /home/crawl-dev/logs/bcadrencrawl.log 2>&1"
schedule3="0 7 * * *"
command4="/home/crawl-dev/dgamelaunch-config/bin/dgl update-gcc bcrawl bcrawl/master >> /home/crawl-dev/logs/bcrawl.log 2>&1"
schedule4="0 8 * * *"
command5="/home/crawl-dev/dgamelaunch-config/bin/dgl compress-ttyrecs"
schedule5="15,30,45 * * * *"
command6="/home/crawl-dev/dgamelaunch-config/bin/dgl update-stable 0.34 >> /home/crawl-dev/logs/0.34.log 2>&1"
schedule6="0 9 * * *"
command7="/home/crawl-dev/dgamelaunch-config/bin/dgl update-gcc dcst dcst/test >> /home/crawl-dev/logs/dcst.log 2>&1"
schedule7="0 10 * * *"
# Check if a crontab file exists for the user, create one if not
if [ ! -e "$HOME/crontab.txt" ]; then
touch "$HOME/crontab.txt"
fi
# Add the commands and schedules to the crontab file
{ echo "$schedule1 $command1"; } >> "$HOME/crontab.txt"
{ echo "$schedule2 $command2"; } >> "$HOME/crontab.txt"
{ echo "$schedule3 $command3"; } >> "$HOME/crontab.txt"
{ echo "$schedule4 $command4"; } >> "$HOME/crontab.txt"
{ echo "$schedule5 $command5"; } >> "$HOME/crontab.txt"
{ echo "$schedule6 $command6"; } >> "$HOME/crontab.txt"
{ echo "$schedule7 $command7"; } >> "$HOME/crontab.txt"
crontab -r
# Install the updated crontab file
crontab "$HOME/crontab.txt"
rm "$HOME/crontab.txt"
echo "Cron jobs have been set up:"
crontab -l