Skip to content

Commit

Permalink
Merge pull request #158 from tkmtnt7000/PR/update-workspace-script
Browse files Browse the repository at this point in the history
  • Loading branch information
708yamaguchi authored Dec 14, 2021
2 parents c4e0f14 + f46f638 commit fc21452
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
3 changes: 3 additions & 0 deletions jsk_fetch_robot/jsk_fetch_startup/launch/fetch_bringup.launch
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,7 @@
</rosparam>
</node>

<!-- send email -->
<node name="send_mail" pkg="jsk_robot_startup" type="email_topic.py" output="screen" />

</launch>
30 changes: 26 additions & 4 deletions jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
#!/usr/bin/env bash

. $HOME/ros/melodic/devel/setup.bash
# Filename should end with .txt to preview the contents in a web browser
LOGFILE=$HOME/ros/melodic/update_workspace.txt

{
set -x

# Update workspace
cd $HOME/ros/melodic/src
ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $HOME/ros/melodic/src/.rosinstall
wstool foreach --git 'git stash'
wstool update --delete-changed-uris
if [ $? -ne 0 ]; then
LC_CTYPE=en_US.UTF-8 /bin/echo -e "Please update workspace manually" | /usr/bin/mail -s "Daily wstool update fails" -r $(hostname)@jsk.imi.i.u-tokyo.ac.jp [email protected]
fi
WSTOOL_UPDATE_RESULT=$?
cd $HOME/ros/melodic
catkin clean aques_talk collada_urdf_jsk_patch -y
catkin init
catkin config -DCMAKE_BUILD_TYPE=Release
catkin build
CATKIN_BUILD_RESULT=$?
# Send mail
MAIL_BODY=""
if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then
MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually. "
fi
if [ $CATKIN_BUILD_RESULT -ne 0 ]; then
MAIL_BODY=$MAIL_BODY"Please catkin build workspace manually."
fi
set +x
} > $LOGFILE 2>&1
rostopic pub -1 /email jsk_robot_startup/Email "header:
seq: 0
stamp: {secs: 0, nsecs: 0}
frame_id: ''
subject: 'Daily workspace update fails'
body: '$MAIL_BODY'
sender_address: '$(hostname)@jsk.imi.i.u-tokyo.ac.jp'
receiver_address: '[email protected]'
smtp_server: ''
smtp_port: ''
attached_files: ['$LOGFILE']"

0 comments on commit fc21452

Please sign in to comment.