/usr/sbin/jobrep-admin is in lcmaps-plugins-jobrep-admin 1.5.6-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #!/bin/sh
sqldir="/usr/share/jobrepository/sql"
dbapwd=;
install() {
user_dbapwd_question $1;
query="\. $sqldir/jobrep-create-basic.sql";
query_exec "root" "$dbapwd" "$query";
}
destroy() {
user_dbapwd_question $1;
query="\. $sqldir/jobrep-drop-total-database.sql";
query_exec "root" "$dbapwd" "$query";
}
show() {
user_dbapwd_question $1;
query="show databases";
query_exec "root" "$dbapwd" "$query" "jobrepository";
query="show tables";
query_exec "root" "$dbapwd" "$query" "jobrepository";
}
user_dbapwd_question () {
if [ -r "$1" -a -s "$1" ]; then
dbapwd=`cat $1`;
else
stty_orig=`stty -g`
echo -n "Enter database password (root): "
stty -echo
read dbapwd
stty $stty_orig
echo
fi
}
query_exec () {
# Parameter list:
# 1: dbauser
# 2: dbapwd
# 3: query
## 4: database
if [ "$4" != "" ]; then
if [ "$2" != "" ];
then
mysql -u$1 -p$2 -D $4 -e "$3";
else
mysql -u$1 -D $4 -e "$3";
fi
else
if [ "$2" != "" ];
then
mysql -u$1 -p$2 -e "$3";
else
mysql -u$1 -e "$3";
fi
fi
}
case "$1" in
install)
install $2;
;;
destroy)
destroy $2;
;;
show)
show $2;
;;
*)
echo $"Usage: $0 install [<db password file>]"
echo $"Usage: $0 destroy [<db password file>]"
echo $"Usage: $0 show [<db password file>]"
exit 1
;;
esac
|