Init: first commit

This commit is contained in:
Kyush 2023-06-23 00:58:55 +09:00
commit 8f5bbe1d6f
6 changed files with 76 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
resilio-sync_x64.tar.gz
rslsync
LICENSE.TXT
storage/

23
force-stop.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# force stop rslsync process
# Check pid file exists
if [ ! -f ./storage/sync.pid ]; then
echo "./storage/sync.pid file not found"
exit 1
fi
# Get pid from ./storage/sync.pid
pid=$(cat ./storage/sync.pid)
# Echo
echo "force stopping rslsync process (pid: $pid)"
# Send SIGKILL to the process
kill -SIGKILL $pid
# Remove the pid file if exists
#rm -f ./storage/sync.pid
# Echo
echo "rslsync process force stopped"

11
setup.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
# Download Resilio Sync binary from https://download-cdn.resilio.com/stable/linux-x64/resilio-sync_x64.tar.gz
wget https://download-cdn.resilio.com/stable/linux-x64/resilio-sync_x64.tar.gz
tar -xvf resilio-sync_x64.tar.gz
# Create storage directory for rslsync data
mkdir -p ./storage
# Echo
echo "Resilio Sync binary downloaded. You can start with ./start.sh"

2
start.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
./rslsync --config user_config.json

26
stop.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
# Stop rslsync process
# Check pid file exists
if [ ! -f ./storage/sync.pid ]; then
echo "./storage/sync.pid file not found"
exit 1
fi
# Get pid from ./storage/sync.pid
pid=$(cat ./storage/sync.pid)
# Echo
echo "stopping rslsync process (pid: $pid)"
# Send SIGTERM to the process and wait for it to exit
kill -SIGTERM $pid
while kill -0 $pid 2> /dev/null; do # PID가 존재하는 동안 대기합니다.
sleep 1 # 1초마다 체크합니다.
done
# Remove the pid file if exists
#rm -f ./storage/sync.pid
# Echo
echo "rslsync process stopped"

10
user_config.json Normal file
View file

@ -0,0 +1,10 @@
{
"storage_path" : "storage",
"pid_file" : "storage/sync.pid",
"webui" :
{
"force_https": true,
"listen" : "127.0.0.1:8888"
}
}