-
Notifications
You must be signed in to change notification settings - Fork 22
/
iroffer.cron
executable file
·48 lines (39 loc) · 992 Bytes
/
iroffer.cron
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
47
48
#!/bin/sh
# SPDX-FileCopyrightText: 2005 David Johnson
# SPDX-FileCopyrightText: 2005-2021 Dirk Meyer
# SPDX-License-Identifier: GPL-2.0-only
# --- How To Use Cron ---
#
# Edit the iroffer.cron file's iroffer_dir, iroffer_exec, and
# iroffer_pid variables
#
# then crontab -e and place the following line in the editor
#
# */5 * * * * /full/path/to/iroffer/iroffer.cron
#
iroffer_dir="/full/path/to/iroffer/"
iroffer_exec="./iroffer -b sample.config"
iroffer_pid="mybot.pid"
#### don't touch below here ####
cd $iroffer_dir
# make sure filesystem isn't full
freespace=`df -k . | tail -1 | awk {'print $4'}`
if [ $freespace -lt 10 ]; then
echo "Filesystem Full!"
exit 75
fi
# see if stale pid file
if [ -f $iroffer_pid ]; then
pid=`cat $iroffer_pid`
if [ `ps -p $pid | wc -l` -eq 2 ]; then
exit
else
echo "Stale PID File"
fi
fi
echo "Starting iroffer..."
$iroffer_exec
#
# @(#) iroffer.cron 1.6@(#)
# pmg@alliance.centerclick.org|iroffer.cron|20011019202404|62443
#