This commit is contained in:
陆柯 2023-09-26 11:29:29 +08:00
parent b7e8448582
commit ab001c8d5f
5 changed files with 81 additions and 22 deletions

View File

@ -1,28 +1,35 @@
#!/bin/bash #!/bin/bash
echo "=== rclone <i> to install, <s> to sync, <w> to web gui" echo "=== rclone <i> to install, <s> to sync, <c> to copy, <w> to web gui"
read -p ">>> " ACTION_TYPE read -p ">>> " ACTION_TYPE
if [ "$ACTION_TYPE" = 'i' ] if [ "$ACTION_TYPE" = 'i' ]
then then
sudo -v ; curl https://rclone.org/install.sh | sudo bash sudo -v ; curl https://rclone.org/install.sh | sudo bash
elif [ "$ACTION_TYPE" = 's' ] elif [[ "$ACTION_TYPE" = 's' || "$ACTION_TYPE" = 'c' ]]
then then
echo "rclone sync from source:" if [ "$ACTION_TYPE" = 's' ]
read -p ">>> " SOURCE_PATH then
echo "rclone sync to target:" RC_CMD='sync'
read -p ">>> " TARGET_PATH elif [ ]
echo "rclone sync with max-age:" then
read -p ">>> " MAX_AGE RC_CMD='copy'
fi
read -p "rclone $RC_CMD from source >>> " SOURCE_PATH
read -p "rclone $RC_CMD into target >>> " TARGET_PATH
# read -p "rclone $RC_CMD with max-age >>> " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件
read -p "rclone $RC_CMD excluding (folders must end with /) >>> " EXCLUDING
echo echo
echo "*****************************" echo "*****************************"
echo "rclone sync $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --max-age=$MAX_AGE --exclude=._* --exclude=.DS_Store --exclude=node_modules" echo "rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}"
echo "*****************************" echo "*****************************"
echo "Start cloning? <y> for yes, <anything else> for quit" echo "Starting? <y> for yes, <anything else> for quit"
read -p ">>> " YES_OR_NOT read -p ">>> " YES_OR_NOT
if [ "$YES_OR_NOT" = 'y' ] if [ "$YES_OR_NOT" = 'y' ]
then then
rclone sync $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --max-age=$MAX_AGE --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/} echo "****************** [rclone $RC_CMD] Start: `date -u -Iseconds` *****************"
rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}
echo "****************** [rclone $RC_CMD] Start: `date -u -Iseconds` *****************"
fi fi
elif [ "ACTION_TYPE" = 'w' ] elif [ "ACTION_TYPE" = 'w' ]
then then

48
run-files-recursively.sh Normal file
View File

@ -0,0 +1,48 @@
echo "***************************************"
echo "find \$FOLDER -mindepth \$MINDEPTH -maxdepth \$MAXDEPTH -type d_f_l -name \"\$PATTERN\" | while read item; do echo \"\$item\"; done"
echo "***************************************"
echo "To find in which path? Enter <path> or <leave blank> for the current path:"
read -p ">>> " FIND_FOLDER
if [ ! "$FIND_FOLDER" ]
then
FIND_FOLDER="."
fi
read -p "mindepth >>> " MINDEPTH
if [ "$MINDEPTH" ]
then
MINDEPTH_CLAUSE="-mindepth $MINDEPTH"
fi
read -p "maxdepth >>> " MAXDEPTH
if [ "$MAXDEPTH" ]
then
MAXDEPTH_CLAUSE="-mindepth $MAXDEPTH"
fi
echo "To find file or directory? <f> for file, <d> for directory, <l> for link, <leave blank> for all:"
read -p ">>> " FIND_TYPE
if [ "$FIND_TYPE" ]
then
FIND_TYPE_CLAUSE="-type $FIND_TYPE"
fi
echo "To match pattern: <pattern> (e.g. '._*', '.*.js') or or <leave blank> for all:"
read -p ">>> " FIND_PATTERN
if [ ! "$FIND_PATTERN" ]
then
FIND_PATTERN="*"
fi
echo "To do something on each: <command> or <leave blank> for 'echo':"
read -p ">>> " FIND_ACTION
if [ ! "$FIND_ACTION" ]
then
FIND_ACTION='echo'
fi
echo "***************************************"
echo "find $FIND_FOLDER $MINDEPTH_CLAUSE $MAXDEPTH_CLAUSE $FIND_TYPE_CLAUSE -name \"$FIND_PATTERN\" | while read item; do $FIND_ACTION \"\$item\"; done"
echo "***************************************"
find $FIND_FOLDER $MINDEPTH_CLAUSE $MAXDEPTH_CLAUSE $FIND_TYPE_CLAUSE -name "$FIND_PATTERN" | while read item; do $FIND_ACTION "$item"; done

View File

@ -12,7 +12,7 @@ mkdir $SETTINGS_FOLDER
seaf-cli init -d $SETTINGS_FOLDER seaf-cli init -d $SETTINGS_FOLDER
seaf-cli start seaf-cli start
echo To sync a librarcy, run commands like: echo To sync a library, run commands like:
echo Download a new folder to sync with: echo Download a new folder to sync with:
echo seaf-cli download -l "library_id" -s "server_url" [-d "parent_folder"] -u "user_name" echo seaf-cli download -l "library_id" -s "server_url" [-d "parent_folder"] -u "user_name"
echo seaf-cli download-by-name -L "library_id" -s "server_url" [-d "target_folder_not_parent"] -u "user_name" echo seaf-cli download-by-name -L "library_id" -s "server_url" [-d "target_folder_not_parent"] -u "user_name"

View File

@ -9,19 +9,26 @@ sudo apt-get install python3 python3-setuptools python3-pip python3-ldap sqlite3
## for seafile 9.*: ## for seafile 9.*:
# sudo pip3 install --timeout=3600 django==3.2.* future Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django-simple-captcha pycryptodome==3.12.0 # sudo pip3 install --timeout=3600 django==3.2.* future Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django-simple-captcha pycryptodome==3.12.0
echo "=== Enter <version number> to install, or <leave blank> for default 9.0.10:" echo "=== Enter <version number> to install, or <leave blank> for default 10.0.1:"
read -p ">>> " SFVERSION read -p ">>> " SFVERSION
if [ ! "$SFVERSION" ] if [ ! "$SFVERSION" ]
then then
SFVERSION="9.0.10" SFVERSION="10.0.1"
fi fi
echo "=== Enter <installation path> for seafile installation, or <leave blank> for default to `pwd`:"
read -p ">>> " INSTALL_PATH
if [ ! "$INSTALL_PATH" ]
then
INSTALL_PATH=`pwd`
fi
sudo mkdir -p "$INSTALL_PATH"
pushd "$INSTALL_PATH"
pushd /faronear
sudo mkdir bin-seafile
cd bin-seafile cd bin-seafile
sudo wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_$SFVERSION_x86-64.tar.gz sudo wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_${SFVERSION}_x86-64.tar.gz
sudo tar -xzf seafile-server_$SFVERSION_x86-64.tar.gz sudo tar -xzf seafile-server_${SFVERSION}_x86-64.tar.gz
ln -s seafile-server-$SFVERSION sea ln -s seafile-server-$SFVERSION sea
cd sea cd sea
sudo ./setup-seafile.sh # to setup seafile+sqlite (setup-seafile-mysql.sh is for mysql). this will create ccnet,conf,seafile-data,seahub-data,seahub.db inside the parent folder /faronear/bin-seafile sudo ./setup-seafile.sh # to setup seafile+sqlite (setup-seafile-mysql.sh is for mysql). this will create ccnet,conf,seafile-data,seahub-data,seahub.db inside the parent folder /faronear/bin-seafile

View File

@ -1,3 +0,0 @@
cd /faronear/bin.seafile/sea
sudo ./seafile.sh start
sudo ./seahub.sh start