Video Archive (Java): Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
 
(5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
== WAR-Datei aktualisieren ==
== WAR-Datei aktualisieren ==
<pre>
cd /opt/tomcat/tomcat9
sudo vi video_war.sh
</pre>


<pre>
<pre>
#!/bin/bash
#!/bin/bash
# Bash Menu Script Example


repository=/home/martin/GitRepository
repository=/home/martin/GitRepository
message_out=/dev/null
#message_out=error.txt


PS3='Please enter your choice: '
PS3='Please enter your choice: '
options=("Update war-file" "Restart server" "Stop server" "Quit")
options=("Update war-file" "Restart server" "Stop server" "Start tail" "Quit")
select opt in "${options[@]}"
select opt in "${options[@]}"
do
do
     case $opt in
     case $opt in
         "Update war-file")
         "Update war-file")
             sudo -u tomcat bin/shutdown.sh >> /dev/null 2>&1;
             sudo -u tomcat bin/shutdown.sh >> ${message_out} 2>&1;
             sudo -u tomcat rm -r ./webapps/video-archive* >> /dev/null 2>&1;
             sudo -u tomcat rm -r ./webapps/video-archive* >> ${message_out} 2>&1;
             sudo cp ${repository}/VideoArchiveServer/target/video-archive.war webapps/ >> /dev/null 2>&1;
             sudo cp ${repository}/VideoArchiveServer/target/video-archive.war webapps/ >> ${message_out} 2>&1;
             sudo chown tomcat:tomcat webapps/video-archive.war >> /dev/null 2>&1;
             sudo chown tomcat:tomcat webapps/video-archive.war >> ${message_out} 2>&1;
             sudo -u tomcat bin/startup.sh >> /dev/null 2>&1;
             sudo -u tomcat bin/startup.sh >> ${message_out} 2>&1;
             ;;
             ;;
         "Restart server")
         "Restart server")
             sudo -u tomcat bin/shutdown.sh >> /dev/null 2>&1;
             sudo -u tomcat bin/shutdown.sh >> ${message_out} 2>&1;
             sudo -u tomcat bin/startup.sh >> /dev/null 2>&1;
             sudo -u tomcat bin/startup.sh >> ${message_out} 2>&1;
             ;;
             ;;
         "Stop server")
         "Stop server")
             sudo -u tomcat bin/shutdown.sh >> /dev/null 2>&1;
             sudo -u tomcat bin/shutdown.sh >> ${message_out} 2>&1;
            ;;
        "Start tail")
            tail -f logs/catalina.out
             ;;
             ;;
         "Quit")
         "Quit")
Zeile 32: Zeile 41:
     esac
     esac
done
done
</pre>
<pre>
sudo chmod 750 video_war.sh
sudo chown tomcat:tomcat video_war.sh
</pre>
</pre>



Aktuelle Version vom 1. November 2018, 11:19 Uhr

WAR-Datei aktualisieren

cd /opt/tomcat/tomcat9
sudo vi video_war.sh
#!/bin/bash

repository=/home/martin/GitRepository
message_out=/dev/null
#message_out=error.txt

PS3='Please enter your choice: '
options=("Update war-file" "Restart server" "Stop server" "Start tail" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Update war-file")
            sudo -u tomcat bin/shutdown.sh >> ${message_out} 2>&1;
            sudo -u tomcat rm -r ./webapps/video-archive* >> ${message_out} 2>&1;
            sudo cp ${repository}/VideoArchiveServer/target/video-archive.war webapps/ >> ${message_out} 2>&1;
            sudo chown tomcat:tomcat webapps/video-archive.war >> ${message_out} 2>&1;
            sudo -u tomcat bin/startup.sh >> ${message_out} 2>&1;
            ;;
        "Restart server")
            sudo -u tomcat bin/shutdown.sh >> ${message_out} 2>&1;
            sudo -u tomcat bin/startup.sh >> ${message_out} 2>&1;
            ;;
        "Stop server")
            sudo -u tomcat bin/shutdown.sh >> ${message_out} 2>&1;
            ;;
        "Start tail")
            tail -f logs/catalina.out
            ;;
        "Quit")
            break
            ;;
        *) echo "invalid option $REPLY";;
    esac
done
sudo chmod 750 video_war.sh
sudo chown tomcat:tomcat video_war.sh

Testen

Spring Security

curl -XPOST -d 'username=martin&password=kirner' http://localhost:8080/video-archive/public/general/login
curl -H 'Authorization: Bearer <UUID>' http://localhost:8080/video-archive/secured/videos/test
curl -H 'Authorization: Bearer <UUID>' http://localhost:8080/video-archive/secured/general/logout


Zurück zu Hauptseite