-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·32 lines (24 loc) · 812 Bytes
/
setup.sh
File metadata and controls
executable file
·32 lines (24 loc) · 812 Bytes
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
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied. Usage: ./setup.sh [abs path to minicom log] , e.g. './setup.sh /home/access/openaccess_log.txt'"
exit 1
fi
echo "Chosen absolute path to OpenAccess log is $1"
touch $1
chmod 777 $1
screen -dmS OA_MINICOM minicom -C $1
chmod +x parse_openaccess_log_in_db.pl
PWD=$(pwd)
###################################################
echo -e "Adding job to crontab : "
echo "* * * * * pi perl $PWD/parse_openaccess_log_in_db.pl $1"
crontab -l > mycron
echo "* * * * * pi perl $PWD/parse_openaccess_log_in_db.pl $1" >> mycron
crontab mycron
rm mycron
CRON_LOG=$(grep -R "log" config.pl | grep -o -E "(\w+\_[A-Za-z]{3}\.[A-Za-z]{3})")
touch $CRON_LOG
chmod 777 $CRON_LOG
echo "Absolute path path to cron log is $PWD/$CRON_LOG"
chmod +x "select.pl"