DokuWiki saves all content to flat text files under a single directory. This design choice was what initially brought me to using the software. I want to backup and restore all content easily. The task of automating backing up the wiki also might serve as a neat project.
If I didn't have a backup utility how would I manually create a backup of this wiki?
Focus on simplicity of interface and implementation over all other concerns. Making the program fast or adding a feature must not compromise its simplicity in any way.
backup [-h]
The ssh command allows you to easily execute one-off remote commands. It also supports streaming a local file to the remote server for execution by using bash's ability to take script input on stdin.
# One-off command. ssh user@example.com 'echo $USER' # Full script. The -s flag to bash causes commands # to be read and executed from stdin. In this case # stdin is the content of script.sh. ssh user@example.com 'bash -s' < script.sh
The ssh command will exit with the same exit code as the remote command or script, making it largely transparent to the caller.
There are a few ways to invoke CLI commands from Python. The two deprecated functions os.system and os.popen will work, but the subprocess module is what the Python developers want us to use.
import subprocess subprocess.call(['ssh', 'user@example.com', 'ls', '-lha'])