-
Notifications
You must be signed in to change notification settings - Fork 8
/
run
executable file
·74 lines (72 loc) · 1.75 KB
/
run
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#below is a shell script that runs updates 3 times a day every day but sunday
#
#PLEASE CHANGE TIME* VARIABLES TO APPROPRIATE TIMES, and CHANGE PATH VARIABLES
#
#KEEP THE TIMES IN CHRONOLOGICAL ORDER AND THE TIME1H and TIME2H values
#represent the hours of TIME1 and TIME2
#########################################################
# use the command "at -l" to get a list of existing at jobs
# use the command "at -r <jobname>" to remove existing at jobs
#########################################################
TIME1=1000
TIME1H=10
TIME2=1700
TIME2H=17
TIME3=2300
#Below is the full command to update a game of conquer
PATHTOCONQ="/d7/c7913/smile/oldgame/conquer -x -d/d7/c7913/smile/oldgame/temp"
#Path to this file
PATHTORUN=/d7/c7913/smile/oldgame/run
#LOG is full path name of log file
LOG=/d7/c7913/smile/oldgame/runlog
/bin/date >> $LOG
$PATHTOCONQ >> $LOG
DAY=`/bin/date | /usr/bin/awk '{ print $1 }'`
echo "day is $DAY" >> $LOG
HOUR=`/bin/date|/usr/bin/awk '{ print $4 }'|/usr/bin/awk -F: '{ print $1 }'`
echo "hour is $HOUR" >> $LOG
#BELOW IS AN EXAMPLE OF A BSD SCRIPT
#switch $DAY
# case Sat:
# set nextday=mon
# breaksw
# default:
# set nextday =
# breaksw
#endsw
case $DAY in
Sat)
nextday=mon
;;
*)
nextday=""
;;
esac
#switch $HOUR
# case 00:
# set nexthour=$TIME1
# breaksw
# default:
# set nexthour=$TIME2
# breaksw
#endsw
case $HOUR in
$TIME1H)
nexthour=$TIME2
echo "nexthour is $nexthour" >> $LOG
;;
$TIME2H)
nexthour=$TIME3
echo "nexthour is $nexthour" >> $LOG
;;
*)
nexthour=$TIME1
echo "nexthour is $nexthour" >> $LOG
;;
esac
#below for bsd (i think)
#/usr/bin/at $nexthour $nextday $PATHTORUN
#below for SYSV
echo "/usr/bin/at $nexthour $nextday < $PATHTORUN" >> $LOG
echo "XXX" >> $LOG
/usr/bin/at $nexthour $nextday < $PATHTORUN