-
Notifications
You must be signed in to change notification settings - Fork 42
/
run.sh
28 lines (22 loc) · 848 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
mongod &
# 数据库未导入
if [ ! -f "/data/db/do_not_delete" ]; then
echo "Initial mongo data"
mongorestore -h localhost -d leanote --dir /root/leanote/mongodb_backup/leanote_install_data/
echo "do not delete this file" >> /data/db/do_not_delete
chmod 400 /data/db/do_not_delete
fi
# conf不存在
if [ ! -f '/data/leanote/conf/app.conf' ]; then
mkdir -p /data/leanote/conf/
cp /root/leanote/conf/app.conf /data/leanote/conf/app.conf
echo "first run, replace secret"
oldStr=`cat /data/leanote/conf/app.conf | grep 'app.secret'`
newStr=app.secret=`cat /proc/sys/kernel/random/uuid`
sed -i "s/${oldStr}/${newStr}/g" /data/leanote/conf/app.conf
fi
cp -n -r /root/leanote /data/
rm -rf /root/leanote/
echo `date "+%Y-%m-%d %H:%M:%S"`' >>>>>> start leanote service'
/data/leanote/bin/run.sh