Ticket #40345

automate publication of docs

오픈 날짜: 2020-04-24 14:14 마지막 업데이트: 2020-04-26 06:20

Reporter:
소유자:
Status:
Closed
Component:
Priority:
3
Severity:
5 - Medium
Resolution:
Fixed
File:
None

Details

The OSDN service provides https://joypy.osdn.io/ which I sort of manually upload using FTP, I was doing this with a different machine that I don't have at the moment, so I don't have the notes I made.

In any event, I should write a simple script to handle publishing the site when changes are made.

Ticket History (3/6 Histories)

2020-04-24 14:14 Updated by: sforman
  • New Ticket "automate publication of docs" created
2020-04-26 05:15 Updated by: sforman
댓글 올리기

In the docs ( https://osdn.net/docs/ProjectWeb_Services ) it says that the web site static content dir (CGI is available, coo'):

/home/groups/<the first letter of the project Unix name>/<the first and the second letters of the project UNIX name>/<project UNIX name>/htdocs/

Becomes:

/home/groups/j/jo/joypy/htdocs/

So the command will be something like (note the trailing slash on the source directory? It's not in the scp man page but the program behaves like rsync where it indicates to copy the contents of the dir not the dir itself. Good to know.):

scp -r \
  ~/Desktop/ArchLayer/System/source/Thun/docs/sphinx_docs/_build/html/ \
  sforman@shell.osdn.net:/home/groups/j/jo/joypy/htdocs/

But how to delete the old contents? This tar command will archive and delete the old site, in a tarball with the date in the name (although it has a space in it, I can look up the format string I want to use)

tar cvz --remove-files \
  -f $HOME/site-backup-$(date -u +'%F-%T').tgz \
  /home/groups/j/jo/joypy/htdocs/*

If I put that in a little script in my home dir I can execute that with ssh (why not just run the command directly? I don't trust the quoting and I don't want to look it up and test it right now. Putting the incantation in a file is faster and easier.)

Wow! Nearly two years since I last logged in:

sforman@bock:~/Desktop/ArchLayer/System/source/Thun$ ssh sforman@shell.osdn.net
Last login: Wed Jun 27 07:42:14 2018 from c-69-181-182-62.hsd1.ca.comcast.net
2020-04-26 05:32 Updated by: sforman
댓글 올리기

I put the backup script in a file called backup-and-remove-htdocs in my home dir and set it to executable. Now I can run it remotely with ssh. So the combined command to replace the website with the latest version is:

cd <...>/Thun
ssh sforman@shell.osdn.net '$HOME/backup-and-remove-htdocs' && \
scp -r ./docs/sphinx_docs/_build/html/ \
  sforman@shell.osdn.net:/home/groups/j/jo/joypy/htdocs/
2020-04-26 05:45 Updated by: sforman
댓글 올리기

That almost works, the only wrinkle is that it puts the content in .../htdocs/html rather than just in .../htdocs, d'oh!

I guess the man page was right after all.

2020-04-26 05:55 Updated by: sforman
댓글 올리기

Use rsync instead:

cd <...>/Thun
ssh sforman@shell.osdn.net '$HOME/backup-and-remove-htdocs' && \
rsync -rv --progress ./docs/sphinx_docs/_build/html/ \
  sforman@shell.osdn.net:/home/groups/j/jo/joypy/htdocs/
2020-04-26 06:20 Updated by: sforman
  • Resolution Update from None to Fixed
  • Status Update from Open to Closed

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login