Merge branch 'master' of ssh://git.karchnu.fr:2202/WeirdOS/service
This commit is contained in:
commit
34a2982ef4
@ -29,6 +29,7 @@ command:
|
||||
create_user
|
||||
create_db
|
||||
create_user_and_db
|
||||
delete_user_and_db
|
||||
END
|
||||
}
|
||||
|
||||
@ -47,6 +48,19 @@ function create_user() {
|
||||
"
|
||||
}
|
||||
|
||||
function print_delete_user() {
|
||||
cat <<END
|
||||
# user deletion
|
||||
psql -p ${pgport} -c "DROP USER ${dbuser};"
|
||||
END
|
||||
}
|
||||
|
||||
function delete_user() {
|
||||
su postgres -c "
|
||||
psql -p ${pgport} -c \"DROP USER ${dbuser};\"
|
||||
"
|
||||
}
|
||||
|
||||
function print_create_db() {
|
||||
cat <<END
|
||||
# database creation
|
||||
@ -58,6 +72,17 @@ function create_db() {
|
||||
su postgres -c "psql -p ${pgport} -c \"CREATE DATABASE ${dbname} OWNER ${dbuser};\""
|
||||
}
|
||||
|
||||
function print_delete_db() {
|
||||
cat <<END
|
||||
# database deletion
|
||||
psql -p ${pgport} -c "DROP DATABASE ${dbname};"
|
||||
END
|
||||
}
|
||||
|
||||
function delete_db() {
|
||||
su postgres -c "psql -p ${pgport} -c \"DROP DATABASE ${dbname};\""
|
||||
}
|
||||
|
||||
for i
|
||||
do
|
||||
case $i in
|
||||
@ -105,6 +130,7 @@ then
|
||||
(create_db) create_db ;;
|
||||
(create_user) create_user ;;
|
||||
(create_user_and_db) create_user ; create_db ;;
|
||||
(delete_user_and_db) delete_user ; delete_db ;;
|
||||
(*) usage $0 ; exit 1 ;;
|
||||
esac
|
||||
else
|
||||
@ -112,6 +138,7 @@ else
|
||||
(create_db) print_create_db ;;
|
||||
(create_user) print_create_user ;;
|
||||
(create_user_and_db) print_create_user ; print_create_db ;;
|
||||
(delete_user_and_db) print_delete_user ; print_delete_db ;;
|
||||
(*) usage $0 ; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user