update
This commit is contained in:
@@ -12,8 +12,10 @@ trap Quit EXIT
|
||||
|
||||
PIDS=
|
||||
GOT_SIGTERM=
|
||||
LOG_DIR='/var/log/cloudreve'
|
||||
DATA_DIR='/var/lib/cloudreve'
|
||||
LOG_DIR=/var/log/cloudreve
|
||||
DATA_DIR=/var/lib/cloudreve
|
||||
SOCK_FILE=/sock/cloudreve
|
||||
CONF_FILE=$DATA_DIR/cloudreve.ini
|
||||
|
||||
function Print {
|
||||
local file=/dev/null
|
||||
@@ -32,9 +34,8 @@ function Quit {
|
||||
}
|
||||
|
||||
function ModifyConf {
|
||||
[ -e $DATA_DIR/cloudreve.ini ] && return 0
|
||||
Print Generating cloudreve.ini ...
|
||||
cat > $DATA_DIR/cloudreve.ini <<-EOF
|
||||
Print Generating $CONF_FILE ...
|
||||
cat > $CONF_FILE <<-EOF
|
||||
[System]
|
||||
Debug = false
|
||||
Mode = master
|
||||
@@ -43,7 +44,8 @@ SessionSecret = $(date +%F | sha256sum | cut -c -64)
|
||||
HashIDSalt = $(date +%T | sha256sum | cut -c -64)
|
||||
|
||||
#[UnixSocket]
|
||||
#Listen = /socket/cloudreve
|
||||
#Listen = $SOCK_FILE
|
||||
#Perm = 0666
|
||||
|
||||
[Database]
|
||||
DBFile = $DATA_DIR/cloudreve.db
|
||||
@@ -71,15 +73,17 @@ EOF
|
||||
|
||||
function StartProc {
|
||||
Print Starting cloudreve ...
|
||||
rm -f /socket/cloudreve
|
||||
/opt/cloudreve -c $DATA_DIR/cloudreve.ini &>> $LOG_DIR/cloudreve.out &
|
||||
cd $DATA_DIR
|
||||
/opt/cloudreve -c cloudreve.ini &>> $LOG_DIR/cloudreve.out &
|
||||
PIDS="$PIDS $!"
|
||||
sleep 8
|
||||
[ -e $SOCK_FILE ] && chmod 0666 $SOCK_FILE
|
||||
Print Cloudreve started.
|
||||
}
|
||||
|
||||
function Main {
|
||||
local pid=
|
||||
ModifyConf
|
||||
[ -e $CONF_FILE ] || ModifyConf
|
||||
StartProc
|
||||
trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM
|
||||
while [ -z "$GOT_SIGTERM" ] && sleep 2; do
|
||||
|
||||
Reference in New Issue
Block a user