gpt4 book ai didi

autorun - 为什么关机时无法将文件上传到保管箱?

转载 作者:行者123 更新时间:2023-12-01 05:55:42 26 4
gpt4 key购买 nike

像jayant所说的那样修复。

cat upload.sh    
/home/Dropbox-Uploader/dropbox_uploader.sh upload -f /home/Dropbox-Uploader/.dropbox_uploader /home/material/* /
date >> /home/upload.log

目录 Material 中的所有文件都可以通过 bash upload.sh上传到我的保管箱中.
我想在关机时编写一个自动运行服务以将文件上传到保管箱。
vim  /etc/systemd/system/upload.service
[Unit]
Description=upload files into dropbox
Before=network.target shutdown.target reboot.target

[Service]
ExecStart=/bin/true
ExecStop=/bin/bash /home/upload.sh
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

启用它:
sudo systemctl enable upload.service

重新启动它。
journalctl -u upload

-- Logs begin at Thu 2018-01-18 22:38:54 EST, end at Tue 2018-04-10 06:55:43 EDT. --
Apr 10 06:48:27 localhost systemd[1]: Started upload files into dropbox.
Apr 10 06:48:27 localhost systemd[1]: Starting upload files into dropbox...
Apr 10 06:48:27 localhost bash[111]: which: no shasum in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
Apr 10 06:48:27 localhost bash[111]: > Uploading "/home/material/test.txt" to "/test.txt"...
Apr 10 06:48:27 localhost bash[111]: Error: Couldn't resolve host.
ln -s /usr/bin/sha1sum /usr/bin/shasum根据 google's result .

第二次重启。
journalctl -u dropbox
Apr 10 06:55:04 localhost systemd[1]: Started upload files into dropbox.
Apr 10 06:55:04 localhost systemd[1]: Starting upload files into dropbox...
Apr 10 06:55:04 localhost bash[113]: shasum: invalid option -- 'a'
Apr 10 06:55:04 localhost bash[113]: Try 'shasum --help' for more information.
Apr 10 06:55:04 localhost bash[113]: shasum: invalid option -- 'a'
Apr 10 06:55:04 localhost bash[113]: Try 'shasum --help' for more information.
Apr 10 06:55:04 localhost bash[113]: > Uploading "/home/material/test.txt" to "/test.txt"...
Apr 10 06:55:04 localhost bash[113]: Error: Couldn't resolve host.

像罗山说的那样,新的问题出现了,
Uploading    by 4 chunks *** FAILED   dropbox

对于问题 Uploading by 4 chunks *** FAILED dropbox ,一些 Material 说如果文件超过 150 mb 应该分块上传。
split -b 10m  /home/upload.tar.gz  /home/material/dropbox
ls /home/material
dropboxaa dropboxac dropboxae dropboxag ......

两者均小于10m。
journalctl -u upload
Apr 19 01:45:26 localhost systemd[1]: Started upload files into dropbox.
Apr 19 01:45:26 localhost systemd[1]: Starting upload files into dropbox...
Apr 19 01:45:27 localhost bash[401]: > Uploading "/home/material/dropboxaa" to "/dropboxaa"... FAILED
Apr 19 01:45:27 localhost bash[401]: An error occurred requesting /upload
Apr 19 01:45:28 localhost bash[401]: > Uploading "/home/material/dropboxab" to "/dropboxab"... FAILED
Apr 19 01:45:40 localhost bash[401]: Some error occured. Please check the log.
Apr 19 01:45:40 localhost systemd[1]: upload.service: main process exited, code=exited, status=1/FAILURE
Apr 19 01:45:40 localhost systemd[1]: Unit upload.service entered failed state.
Apr 19 01:45:40 localhost systemd[1]: upload.service failed.

为什么 > Uploading "/home/material/dropboxaa" to "/dropboxaa"... FAILED ?

最佳答案

脚本的第二条指令不可能在不执行第一条指令的情况下执行。尝试重定向 dropbox_uploader.sh 的错误输出看看是什么失败了。

假设您正在使用 dropbox-uploader ,尝试指定配置文件的确切位置。请参阅在他们的 README.md 中作为 cron 作业运行部分

/home/Dropbox-Uploader/dropbox_uploader.sh -f /path/to/.dropbox_uploader upload /home/material/*  /

关于autorun - 为什么关机时无法将文件上传到保管箱?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49688112/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com