Why can't you upload files to Dropbox when shutting down?

Correct as the Jayants say.

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

All files in the catalog material can be uploaded to my Dropbox using bash upload.sh.
I want to write an autorun service at shutdown to upload files to Dropbox.

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

Enable it with:

sudo systemctl enable upload.service

To reload it.

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/shasumaccording to the result of Google .

Reboot a second time.

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.

Do, as Raushan says, a new question,

Uploading    by 4 chunks *** FAILED   dropbox

For the problem Uploading by 4 chunks *** FAILED dropbox, some materials say that if files larger than 150 mb should be loaded into chunks.

split -b 10m  /home/upload.tar.gz  /home/material/dropbox
ls  /home/material
dropboxaa  dropboxac  dropboxae  dropboxag  ......

Both of them are less than 10 m.

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.

Why > Uploading "/home/material/dropboxaa" to "/dropboxaa"... FAILED?

+4
source share
2 answers

, script . dropbox_uploader.sh, , .

, dropbox-uploader, . . " cron" README.md

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

:

, After=network.target Before=network.target,

[Unit]
Description=upload files into dropbox
Before=shutdown.target  reboot.target
After=network.target 

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

[Install]
WantedBy=multi-user.target  

: https://serverfault.com/a/785355

shasum:

, Fedora 25.

shasum perl-Digest-SHA, yum install perl-Digest-SHA Linux RedHat

: https://superuser.com/a/1180163

0

Source: https://habr.com/ru/post/1695854/


All Articles