codeaprendiz.github.io

DevOps Essentials

View on GitHub

curl

NAME

curl - transfer a URL

SYNOPSIS

curl [options] [URL…]

DESCRIPTION

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

OPTIONS

EXAMPLES

$ curl -vkso /dev/null 'https://121.170.212.70/healthcheck/healthcheck.htm' -H'X-test-Debug: 1' -H'Host: test.groceries.org.com'

curl google.com

$ curl goole.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

Using curl to deploy the artifact in tomcat

export DEPLOY_SOURCE_DIR=/apps/home/servers/Tomcat/deploy
export TOMCAT_USER=username
export TOMCAT_PASSWORD=userpassword
export TOMCAT_HOST=localhost
export TOMCAT_PORT=9090

curl -v -u $TOMCAT_USER:$TOMCAT_PASSWORD -T $DEPLOY_SOURCE_DIR/artifact.war http://$TOMCAT_HOST:$TOMCAT_PORT/manager/text/deploy?path=/offer