Skip to content

Instantly share code, notes, and snippets.

@andyone
Created September 29, 2018 23:29
Show Gist options
  • Select an option

  • Save andyone/1260557ea25be3aedceabd051c7fea0b to your computer and use it in GitHub Desktop.

Select an option

Save andyone/1260557ea25be3aedceabd051c7fea0b to your computer and use it in GitHub Desktop.
#!/bin/bash
main() {
if [[ "$1" == "6" ]] ; then
check6
else
check7
fi
}
check6() {
pushd "/etc/init.d"
for ver in $(ls -1 pg*) ; do
service "$ver" initdb
sleep 1
service "$ver" start
sleep 1
service "$ver" status
sleep 1
service "$ver" stop
sleep 1
done
popd
}
check7() {
pushd "/etc/init.d"
for ver in $(ls -1 postgresql*) ; do
service "$ver" initdb
sleep 1
systemctl start ${ver}.service
sleep 1
systemctl status ${ver}.service
sleep 1
systemctl stop ${ver}.service
sleep 1
done
popd
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment