-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoaipoll
More file actions
executable file
·40 lines (31 loc) · 863 Bytes
/
oaipoll
File metadata and controls
executable file
·40 lines (31 loc) · 863 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
33
34
35
36
37
38
39
#!/bin/bash
usage()
{
echo "This script enables and disables the oai-pmh polling by toggling the flag in the database."
echo "Usage: $0 {enable|disable|status}"
exit 1
}
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $scriptdir
. variables.conf
case "$1" in
enable)
echo "set to 1"
mysql -uoaipmh -p$OAIPMH_PASSWORD -e"UPDATE oaipmh.rcAdmin SET pollingEnabled=1;"
;;
disable)
echo "set to 0"
mysql -uoaipmh -p$OAIPMH_PASSWORD -e"UPDATE oaipmh.rcAdmin SET pollingEnabled=0;"
;;
status)
mysql -uoaipmh -p$OAIPMH_PASSWORD -e"select pollingEnabled from oaipmh.rcAdmin;" | sed '2!d'
;;
log)
state=`mysql -uoaipmh -p$OAIPMH_PASSWORD -e"select pollingEnabled from oaipmh.rcAdmin;" | sed '2!d'`
timestamp=`date "+%Y-%m-%dT%H:%M:%S"`
echo $timestamp $state
;;
*)
usage
;;
esac