Skip to content

Instantly share code, notes, and snippets.

@iamkristian
Created June 16, 2011 07:12
Show Gist options
  • Save iamkristian/1028818 to your computer and use it in GitHub Desktop.
Save iamkristian/1028818 to your computer and use it in GitHub Desktop.
How to deploy to oc4j with continuous integration tools - like hudson
#!/bin/bash
ROOTDIR=.
if [[ $1 = "hudson" ]] ; then
ROOTDIR="`pwd`/<ear-project-dir>"
else
ROOTDIR="."
fi
TARGET="$ROOTDIR/target"
ID="$ROOTDIR/src/main/cert/id_dsa"
USER=<username>@<hostname>
DEST=/tmp/
INSTANCE=<instance>
DCMCTL=<path-to-oc4j-installation>/dcm/bin/dcmctl
UNDEPLOY="undeployApplication <applicationname> -co $INSTANCE"
RESTART="restart -co $INSTANCE"
DEPLOY="deployApplication -f \`ls /tmp/*.ear\` -a <applicationname> -co $INSTANCE"
if [[ -d $TARGET ]] ; then
echo "Deploying to $INSTANCE"
ssh -i $ID $USER "rm /tmp/*.ear"
scp -i $ID $TARGET/*.ear $USER:$DEST
ssh -i $ID $USER "$DCMCTL $UNDEPLOY"
ssh -i $ID $USER "$DCMCTL $DEPLOY"
echo "Done deploying"
else
echo "Nothing to deploy"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment