Simple example.

pull/7/head
Ferry Boender 10 years ago
parent b613dd7c7e
commit ffda932161
  1. 0
      examples/simple/htaccess
  2. 29
      examples/simple/job_add_user.sh
  3. 7
      examples/simple/job_import.sh
  4. 50
      examples/simple/simple.json

@ -0,0 +1,29 @@
#!/bin/sh
HTACCESS=htaccess
err() {
echo $* >&2
exit 1
}
if [ -z "$password1" ]; then
err "Empty password specified"
fi
if [ "$password1" != "$password2" ]; then
err "Passwords do not match."
fi
if [ $(egrep "^$username:" $HTACCESS) ]; then
UPDATE=1
else
UPDATE=0
fi
htpasswd -s -b $HTACCESS $username $password1 || exit $?
if [ "$UPDATE" -eq 1 ]; then
echo "User password updated"
else
echo "User created"
fi

@ -0,0 +1,7 @@
#!/bin/sh
MYSQL_DEFAULTS_FILE="my.cnf"
MYSQL="mysql --defaults-file=$MYSQL_DEFAULTS_FILE"
echo "echo 'DROP DATABASE scriptform_acc' | $MYSQL"
echo "$MYSQL < dbs/${sample_db}.sql"

@ -0,0 +1,50 @@
{
"title": "Test server",
"forms": {
"import": {
"title": "Import data",
"description": "Import CSV data into a database",
"submit_title": "Import",
"script": "job_import.sh",
"fields": [
{
"name": "target_db",
"title": "Database to import to",
"type": "select",
"options": [
["devtest", "Dev Test db"],
["prodtest", "Prod Test db"]
]
},
{
"name": "csv_file",
"title": "CSV file",
"type": "file"
}
]
},
"add_user": {
"title": "Add user",
"description": "Add a user to the htaccess file or change their password",
"submit_title": "Add user",
"script": "job_add_user.sh",
"fields": [
{
"name": "username",
"title": "Username",
"type": "string"
},
{
"name": "password1",
"title": "Password",
"type": "password"
},
{
"name": "password2",
"title": "Password (Repear)",
"type": "password"
}
]
}
}
}
Loading…
Cancel
Save