-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.sh
49 lines (43 loc) · 1.6 KB
/
startup.sh
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
#!/bin/sh
##########################################################################
# Yet Another Monitor (YAMon)
# Copyright (c) 2013-present Al Caughey
# All rights reserved.
#
# Call this file from the Administration-->Commands tab in the DD-WRT GUI
#
# NEW: by default this script will delay for 10 seconds before launching
# yamon###.sh... you can shorten or lengthen the delay via a parameter
# e.g., >>> startup.sh 0
# or >>> startup.sh 30
#
##########################################################################
d_baseDir=$(cd "$(dirname "$0")" && pwd)
source "$d_baseDir/config.file"
source "${d_baseDir}/includes/versions.sh"
source "${d_baseDir}/includes/defaults.sh"
source "$d_baseDir/includes/util$_version.sh"
source "$d_baseDir/strings/$_lang/strings.sh"
np=$(ps | grep -v grep | grep -c yamon$_file_version)
if [ "$np" -gt "0" ] || [ -d "$_lockDir" ] ; then
echo -e "$_s_running"
exit 0
fi
# wait for a bit (10 seconds)... depending on your router you can make this longer or shorter
delay=$1
[ -z "$delay" ] && delay=10
echo -e "${los}${_nl}YAMon will be started following a delay of $delay seconds.${_nl}
NB - depending on your router and firmware, you may have to increase${_nlsp}this delay (to allow other processes to startup properly),${_nlsp}or you may be able to eliminate the delay${_nlsp}altogether.${los}${_nl}"
i=0
while [ $i -lt $delay ] ; do
echo -n '.'
sleep 1
i=$(($i + 1))
done
[ -n "$_canClear" ] && clear
# launch the script in nice mode (thanks to Jeff Page)
if [ -z "$(which nice)" ] ; then
${d_baseDir}/yamon${_version}.sh &
else
nice ${d_baseDir}/yamon${_version}.sh &
fi