1 Example bash script (creates multiple shaarli instances and generates an HTML index of them)
9 shaarli_base_dir='/var/www/shaarli'
10 accounts='bob john whatever username'
11 shaarli_repo_url='https://github.com/shaarli/Shaarli'
14 #clone multiple shaarli instances
15 if [ ! -d "$shaarli_base_dir" ]; then mkdir "$shaarli_base_dir"; fi
17 for account in $accounts; do
18 if [ -d "$shaarli_base_dir/$account" ];
19 then echo "[info] account $account already exists, skipping";
20 else echo "[info] creating new account $account ..."; git clone --quiet "$shaarli_repo_url" -b "$ref" "$shaarli_base_dir/$account"; fi
23 #generate html index of shaarlis
24 htmlhead='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
25 <!-- Minimal html template thanks to http://www.sitepoint.com/a-minimal-html-document/ -->
28 <meta http-equiv="content-type" content="text/html; charset=utf-8">
29 <title>My Shaarli farm</title>
30 <style>body {font-family: "Open Sans"}</style>
34 <h1>My Shaarli farm</h1>
35 <ul style="list-style-type: none;">'
47 for account in $accounts; do accountlinks="$accountlinks\n<li><a href=\"$account\">$account</a></li>"; done
48 if [ -d "$shaarli_base_dir/index.html" ]; then echo "[removing old index.html]"; rm "$shaarli_base_dir/index.html" ]; fi
49 echo "[info] generating new index of shaarlis"
50 echo -e "$htmlhead $accountlinks $htmlfooter" > "$shaarli_base_dir/index.html"
52 echo "[info] list of accounts: $accounts"
53 echo "[info] contents of $shaarli_base_dir:"
54 tree -a -L 1 "$shaarli_base_dir"
57 This script just serves as an example. More precise or complex (applying custom configuration, etc) automation is possible using configuration management software like [Ansible](https://www.ansible.com/)