diff --git a/Aktardb.cpp b/Aktardb.cpp index ac59c07..8c9012e 100644 --- a/Aktardb.cpp +++ b/Aktardb.cpp @@ -5,7 +5,7 @@ using namespace std; // CLASS DECLARATION class DB -{ +{cnmsb cm public: void store(); @@ -152,4 +152,4 @@ int main() cout << "Have a good day! Bye!" << endl; exit(0); -}; \ No newline at end of file +}; diff --git a/BackupDB.sh b/BackupDB.sh new file mode 100644 index 0000000..8a07611 --- /dev/null +++ b/BackupDB.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +helpFunction() +{ + echo "" + echo "Usage: $0 -u username -p password -d database" + echo -e "\t-u Username of Database" + echo -e "\t-p Password for that DB user" + echo -e "\t-d Database Name" + exit 1 # Exit script after printing help +} + +while getopts "u:p:d:" opt +do + case "$opt" in + u ) user="$OPTARG" ;; + p ) pass="$OPTARG" ;; + d ) db="$OPTARG" ;; + ? ) helpFunction ;; # Print helpFunction in case parameter is non-existent + esac +done + +# Print helpFunction in case parameters are empty +if [ -z "$user" ] || [ -z "$pass" ] || [ -z "$db" ] +then + echo "Some or all of the parameters are empty"; + helpFunction +fi + +# Begin script in case all parameters are correct +echo "${user} ${pass} ${db}" +mysqldump -u ${user} -p${pass} ${db} > ~/${db}_`date +%Y-%m-%d`.sql diff --git a/Form.html b/Form.html new file mode 100644 index 0000000..f41836d --- /dev/null +++ b/Form.html @@ -0,0 +1,47 @@ + + + +
+ + + +