File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Set up logging
4+ LOG_FILE=" /var/log/nmrium-update.log"
5+ echo " $( date) : Starting update check" >> " $LOG_FILE "
6+
7+ # Function to check and update a specific image and service
8+ check_and_update () {
9+ local image=$1
10+ local service=$2
11+
12+ echo " $( date) : Checking for updates for $image " >> " $LOG_FILE "
13+
14+ # Pull the latest image
15+ docker pull $image
16+
17+ # Get the current image ID
18+ current_id=$( docker images $image --format " {{.ID}}" )
19+
20+ # Get the new image ID after pull
21+ new_id=$( docker images $image --format " {{.ID}}" )
22+
23+ # If the IDs are different, restart the service
24+ if [ " $current_id " != " $new_id " ]; then
25+ echo " $( date) : New image detected for $image , restarting $service " >> " $LOG_FILE "
26+ docker-compose restart $service
27+ else
28+ echo " $( date) : No updates available for $image " >> " $LOG_FILE "
29+ fi
30+ }
31+
32+ # Change to the directory containing docker-compose.yml
33+ cd " $( dirname " $0 " ) "
34+
35+ # Check both development and production images
36+ check_and_update " nfdi4chem/nmrium-react-wrapper:dev-latest" " nmrium-dev"
37+ check_and_update " nfdi4chem/nmrium-react-wrapper:latest" " nmrium-prod"
38+
39+ echo " $( date) : Update check completed" >> " $LOG_FILE "
You can’t perform that action at this time.
0 commit comments