Update helper-script and faraday.service
Sophie Brun
3 years ago
5 | 5 |
|
6 | 6 |
[Service]
|
7 | 7 |
Type=simple
|
8 | |
ExecStartPre=/bin/sh -c 'if ! sudo -u postgres -- psql -lqt | cut -d \| -f 1 | grep -qw faraday; then faraday-manage initdb; fi'
|
9 | 8 |
ExecStart=faraday-server
|
10 | 9 |
|
11 | 10 |
[Install]
|
0 | 0 |
#!/bin/sh
|
1 | 1 |
|
2 | |
aux_file_path="$HOME/.faraday/password_changed.txt"
|
3 | |
URL="localhost:5985"
|
|
2 |
aux_file_path="/root/.faraday/password_changed.txt"
|
|
3 |
URL="http://localhost:5985"
|
4 | 4 |
|
5 | |
systemctl start faraday
|
|
5 |
systemctl start postgresql
|
|
6 |
if sudo [ ! -d /root/.faraday ]; then
|
|
7 |
echo ">>> Setup"
|
|
8 |
sudo faraday-server setup_environment
|
|
9 |
fi
|
|
10 |
|
|
11 |
if ! sudo -u postgres -- psql -lqt | cut -d \| -f 1 | grep -qw faraday; then
|
|
12 |
echo ">>> Init database"
|
|
13 |
sudo faraday-manage initdb
|
|
14 |
fi
|
|
15 |
|
|
16 |
echo ">>> Start faraday.service"
|
|
17 |
sudo systemctl start faraday
|
6 | 18 |
sleep 3
|
7 | |
if [ ! -f $aux_file_path ]; then
|
8 | |
touch $aux_file_path
|
9 | |
echo "Please, set a new password for the Faraday's default user 'faraday'"
|
10 | |
faraday-manage change-password
|
11 | |
xdg-open "${URL}" 2>/dev/null >/dev/null &
|
12 | |
else
|
13 | |
xdg-open "${URL}" 2>/dev/null >/dev/null &
|
|
19 |
|
|
20 |
if systemctl is-active --quiet faraday; then
|
|
21 |
if sudo [ ! -f $aux_file_path ]; then
|
|
22 |
sudo touch $aux_file_path
|
|
23 |
echo "Please, set a new password for the Faraday's default user 'faraday'"
|
|
24 |
sudo faraday-manage change-password
|
|
25 |
xdg-open "${URL}" 2>/dev/null >/dev/null &
|
|
26 |
else
|
|
27 |
xdg-open "${URL}" 2>/dev/null >/dev/null &
|
|
28 |
fi
|
14 | 29 |
fi
|
15 | |
systemctl stop faraday
|