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

test -x /usr/local/bin/cscli || exit 0

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

/usr/local/bin/cscli --error -o human hub update

upgraded=$(/usr/local/bin/cscli --error -o human hub upgrade)
if [ -n "$upgraded" ]; then
    # splay initial metrics push
    sleep "$(jot -r 1 1 60)"
    service crowdsec onestatus && service crowdsec onereload
fi

exit 0