Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Thursday at 9:10 PM
FREE SEO Check & Google Maps Check for Sri Lankan Businesses | Web Design, Website Price Rs 14,900 |
LankaSolve
Updated:
Oct 20, 2026
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Oct 17, 2026
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Oct 14, 2026
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Problems and Troubleshooting
CI/CD pipeline ගැන දන්න වැඩ්ඩෝ එන්නකෝ | DevOps
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="KandyMalli" data-source="post: 29063950" data-attributes="member: 566261"><p>Github workflow</p><p>Ansible/ bash script </p><p></p><p>Meewa oni wei</p><hr /><p>Sure, here is a script that you can use to get a pull when a commit is made to the main branch and deploy the WAR file to the Tomcat server, then restart it:</p><p></p><p>```</p><p>#!/bin/bash</p><p></p><p># Get the current branch name</p><p>branch_name=$(git rev-parse --abbrev-ref HEAD)</p><p></p><p># If the current branch is main, then deploy the WAR file</p><p>if [[ $branch_name == "main" ]]; then</p><p></p><p> # Get the WAR file</p><p> war_file=target/my-app.war</p><p></p><p> # Deploy the WAR file to Tomcat</p><p> cp $war_file $CATALINA_HOME/webapps</p><p></p><p> # Restart Tomcat</p><p> service tomcat restart</p><p>fi</p><p>```</p><p></p><p>This script will first get the current branch name using the `git rev-parse --abbrev-ref HEAD` command. If the current branch is main, then the script will get the WAR file using the `target/my-app.war` path. The WAR file will then be deployed to Tomcat using the `cp` command. Finally, Tomcat will be restarted using the `service tomcat restart` command.</p><p></p><p>To run this script, you can save it as a `.sh` file and then run it from the command line. For example, if you saved the script as `deploy.sh`, you could run it by typing the following command into the command line:</p><p></p><p>```</p><p>bash deploy.sh</p><p>```</p><p></p><p>This will deploy the WAR file to Tomcat and restart the server.</p><p></p><p>----</p><p></p><p>ChatGPT walin ahanna mcn. Dan wada lesii</p><p>------ <span style="font-size: 10px">Post added on [DATETIME="UT"]1690575592[/DATETIME]</span></p></blockquote><p></p>
[QUOTE="KandyMalli, post: 29063950, member: 566261"] Github workflow Ansible/ bash script Meewa oni wei [HR][/HR] Sure, here is a script that you can use to get a pull when a commit is made to the main branch and deploy the WAR file to the Tomcat server, then restart it: ``` #!/bin/bash # Get the current branch name branch_name=$(git rev-parse --abbrev-ref HEAD) # If the current branch is main, then deploy the WAR file if [[ $branch_name == "main" ]]; then # Get the WAR file war_file=target/my-app.war # Deploy the WAR file to Tomcat cp $war_file $CATALINA_HOME/webapps # Restart Tomcat service tomcat restart fi ``` This script will first get the current branch name using the `git rev-parse --abbrev-ref HEAD` command. If the current branch is main, then the script will get the WAR file using the `target/my-app.war` path. The WAR file will then be deployed to Tomcat using the `cp` command. Finally, Tomcat will be restarted using the `service tomcat restart` command. To run this script, you can save it as a `.sh` file and then run it from the command line. For example, if you saved the script as `deploy.sh`, you could run it by typing the following command into the command line: ``` bash deploy.sh ``` This will deploy the WAR file to Tomcat and restart the server. ---- ChatGPT walin ahanna mcn. Dan wada lesii ------ [SIZE=2]Post added on [DATETIME="UT"]1690575592[/DATETIME][/SIZE] [/QUOTE]
Insert quotes…
Verification
Nawa warak dahaya keeyada? (Namaya wadi kireema dahaya)
Post reply
Top
Bottom