Carlosinfl
Loves the juice
- Joined
- Sep 25, 2002
- Messages
- 6,633
Every week, I deploy updates to our web server / developer portal running JBoss on CentOS 6.5. The .war file updates for the web portal are developed by our engineering team and it's my task as a System Administrator to do the following:
STAGING_DIR=/usr/local/tmp/depoy/
TARGET_DIR=/usr/local/jboss/standalone/deployments/
^Above^ are the '3' commands I manually run in Bash. The 'web-3.0-XXXXX.war' file is the highest revision / number / release in the /.../deploy/ directory. What I am looking for is for someone to please help me automate these simple commands for this task in #!/bin/bash. I have never written a script and don't intend to sound / look lazy but I am currently reading UNIX Shell Scripting 2nd Edition. I would need the scripts to execute the following commands in order w/ the variables defined above and the cp command needs to sort the *.war files in order to locate the latest build or sort from the newest time stamp on the file listing and copy that file into the $TARGET_DIR as 'web-3.0.war'.
I would greatly appreciate seeing how people who know anything more about scripting would write something like this in Bash. I know there are several different ways in *NIX to achieve the same goal but I really would love assistance in this.
STAGING_DIR=/usr/local/tmp/depoy/
TARGET_DIR=/usr/local/jboss/standalone/deployments/
Code:
service jboss stop
cp /usr/local/tmp/deploy/web-3.0-XXXXX.war /usr/local/jboss/standalone/deployments/web-3.0.war
service jboss start
^Above^ are the '3' commands I manually run in Bash. The 'web-3.0-XXXXX.war' file is the highest revision / number / release in the /.../deploy/ directory. What I am looking for is for someone to please help me automate these simple commands for this task in #!/bin/bash. I have never written a script and don't intend to sound / look lazy but I am currently reading UNIX Shell Scripting 2nd Edition. I would need the scripts to execute the following commands in order w/ the variables defined above and the cp command needs to sort the *.war files in order to locate the latest build or sort from the newest time stamp on the file listing and copy that file into the $TARGET_DIR as 'web-3.0.war'.
I would greatly appreciate seeing how people who know anything more about scripting would write something like this in Bash. I know there are several different ways in *NIX to achieve the same goal but I really would love assistance in this.
As an Amazon Associate, HardForum may earn from qualifying purchases.