Ubuntu 管理心得

搜尋此網誌

2024年2月24日 星期六

disable onedrive service for user

 
systemctl --user stop onedrive
systemctl --user disable onedrive
 
delete the symbolic link
sudo rm /etc/systemd/user/default.target.wants/onedrive.service
 
which is linked from 
/usr/lib/systemd/user/onedrive.service
 
 


2024年2月23日 星期五

sync onedrive

#!/bin/bash
if [ "$#" -lt 1 ]; then
#    echo "Usage: $0 <upload_path>"
    echo "Usage: $0 <full local  directory> "
    echo "e.g. $0 /home/chiao/Python"
    exit
fi
SUBDIR=$(basename "$1")
ROOTPATH=$(dirname "$1")
read -p "Start dryrun (press y or n) ? " yn
case $yn in
#     [Yy]* ) echo "Start dryrun (not really uploading) ..." ;onedrive --synchronize --verbose --resync --dry-run;;
#     [Yy]* ) echo "Start dryrun (not really uploading) ..." ;onedrive --syncdir ${1} --synchronize --skip-symlinks  --verbose --dry-run --resync;;
     [Yy]* ) echo "Start dryrun (not really uploading) ..." ;onedrive --syncdir ${ROOTPATH} --single-directory ${SUBDIR} --synchronize --skip-symlinks  --verbose --dry-run --resync;;
#     [Yy]* ) echo "Start dryrun (not really uploading) ..." ;echo "Testing dryrun";;
esac     
read -p "Strat uploading? (press y or n) " yn
case $yn in
#    [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T);onedrive --synchronize --verbose --resync; echo "Start at:  $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
#    [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T);onedrive --syncdir ${1} --synchronize --skip-symlinks --verbose --resync; echo "Start at:  $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
    [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T);onedrive --syncdir ${ROOTPATH} --single-directory ${SUBDIR} --synchronize --skip-symlinks --verbose --resync; echo "Start at:  $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
#     [Yy]* ) echo "-----------------------------------------------------------";START=$(date +%F\ %T); echo "Testing";echo "Start at:  $START"; echo "End at: $(date +%F\ %T)"; echo "-----------------------------------------------------------";;
    [Nn]* ) exit;;
    * ) echo "Please answer yes or no.";;
esac