Skip to content

Commit 28f6b06

Browse files
committed
Merge branch 'master' of [email protected]:/DoliCloud/sellyoursaas
2 parents 48dc380 + 67484cc commit 28f6b06

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Unit]
2+
Description=Disable cron if IP is not allowed
3+
After=network-online.target
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/bin/bash -c '
8+
IP=$(hostname -I | awk "{print \$1}");
9+
if [ "$IP" != "1.2.3.4" ]; then
10+
systemctl stop cron;
11+
echo "Cron stopped by service /etc/systemd/system/sellyoursaas-disable-cron-if-wrong-ip.service due to wrong IP: $IP" >> /var/log/cron_disabled.log;
12+
fi
13+
'
14+
15+
[Install]
16+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)