Utility functions for scripting installations.
Utility functions for scripting installations.
(cached-wget! url)
(cached-wget! url opts)
Downloads a string URL to the Jepsen wget cache directory, and returns the full local filename as a string. Skips if the file already exists. Local filenames are base64-encoded URLs, as opposed to the name of the file--this is helpful when you want to download a package like https://foo.com/v1.2/foo.tar; since the version is in the URL but not a part of the filename, downloading a new version could silently give you the old version instead.
Options:
:force? Even if we have this cached, download the tarball again anyway.
Downloads a string URL to the Jepsen wget cache directory, and returns the full local filename as a string. Skips if the file already exists. Local filenames are base64-encoded URLs, as opposed to the name of the file--this is helpful when you want to download a package like https://foo.com/v1.2/foo.tar; since the version is in the URL but not a part of the filename, downloading a new version could silently give you the old version instead. Options: :force? Even if we have this cached, download the tarball again anyway.
(daemon-running? pidfile)
Given a pidfile, returns true if the pidfile is present and the process it contains is alive, nil if the pidfile is absent, false if it's present and the process doesn't exist.
Strictly this doesn't mean the process is RUNNING; it could be asleep or a zombie, but you know what I mean. ;-)
Given a pidfile, returns true if the pidfile is present and the process it contains is alive, nil if the pidfile is absent, false if it's present and the process doesn't exist. Strictly this doesn't mean the process is RUNNING; it could be asleep or a zombie, but you know what I mean. ;-)
(ensure-user! username)
Make sure a user exists.
Make sure a user exists.
(file? filename)
(grepkill! pattern)
(grepkill! signal pattern)
Kills processes by grepping for the given string.
Kills processes by grepping for the given string.
(install-archive! url dest)
(install-archive! url dest force?)
Gets the given tarball URL, caching it in /tmp/jepsen/, and extracts its sole top-level directory to the given dest directory. Deletes current contents of dest. Supports both zip files and tarballs, compressed or raw. Returns dest.
Standard practice for release tarballs is to include a single directory, often named something like foolib-1.2.3-amd64, with files inside it. If only a single directory is present, its contents will be moved to dest, so foolib-1.2.3-amd64/my.file becomes dest/my.file. If the tarball includes multiple files, those files are moved to dest, so my.file becomes dest/my.file.
Gets the given tarball URL, caching it in /tmp/jepsen/, and extracts its sole top-level directory to the given dest directory. Deletes current contents of dest. Supports both zip files and tarballs, compressed or raw. Returns dest. Standard practice for release tarballs is to include a single directory, often named something like foolib-1.2.3-amd64, with files inside it. If only a single directory is present, its *contents* will be moved to dest, so foolib-1.2.3-amd64/my.file becomes dest/my.file. If the tarball includes multiple files, those files are moved to dest, so my.file becomes dest/my.file.
(install-tarball! node url dest)
(install-tarball! node url dest force?)
(ls)
(ls dir)
A seq of directory entries (not including . and ..). TODO: escaping for control chars in filenames (if you do this, WHO ARE YOU???)
A seq of directory entries (not including . and ..). TODO: escaping for control chars in filenames (if you do this, WHO ARE YOU???)
(ls-full dir)
Like ls, but prepends dir to each entry.
Like ls, but prepends dir to each entry.
(start-daemon! opts bin & args)
Starts a daemon process, logging stdout and stderr to the given file.
Invokes bin
with args
. Options are:
:background? :chdir :logfile :make-pidfile? :match-executable? :match-process-name? :pidfile :process-name
Starts a daemon process, logging stdout and stderr to the given file. Invokes `bin` with `args`. Options are: :background? :chdir :logfile :make-pidfile? :match-executable? :match-process-name? :pidfile :process-name
A list of standard options we pass to wget
A list of standard options we pass to wget
(stop-daemon! pidfile)
(stop-daemon! cmd pidfile)
Kills a daemon process by pidfile, or, if given a command name, kills all processes with that command name, and cleans up pidfile.
Kills a daemon process by pidfile, or, if given a command name, kills all processes with that command name, and cleans up pidfile.
(tmp-dir!)
Creates a temporary directory under /tmp/jepsen and returns its path.
Creates a temporary directory under /tmp/jepsen and returns its path.
Where should we put temporary files?
Where should we put temporary files?
(wget! url)
(wget! url force?)
Downloads a string URL and returns the filename as a string. Skips if the file already exists.
Downloads a string URL and returns the filename as a string. Skips if the file already exists.
Directory for caching files from the web.
Directory for caching files from the web.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close