aboutsummaryrefslogtreecommitdiff
path: root/security/crowdsec/files/upgrade-hub.in
blob: b5b6fd2565c5106f7505e422e6c6524762f89b29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

test -x %%PREFIX%%/bin/cscli || exit 0

# splay hub upgrade and crowdsec reload
sleep "$(jot -r 1 1 300)"

# favor the opnsense plugin's cron if it's there
test -e /usr/local/etc/cron.d/oscrowdsec.cron && exit 0

%%PREFIX%%/bin/cscli --error -o human hub update

upgraded=$(%%PREFIX%%/bin/cscli --error -o human hub upgrade)
if [ -n "$upgraded" ]; then
    service crowdsec onestatus && service crowdsec onereload
fi

exit 0