Skip to content

Commit

Permalink
[jsk_fetch_startup] Attach log file when update_workspace failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmtnt7000 committed Dec 14, 2021
1 parent a8e2611 commit f46f638
Show file tree
Hide file tree
Showing 2 changed files with 20 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>
21 changes: 17 additions & 4 deletions jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/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
Expand All @@ -18,11 +21,21 @@ CATKIN_BUILD_RESULT=$?
# Send mail
MAIL_BODY=""
if [ $WSTOOL_UPDATE_RESULT -ne 0 ]; then
MAIL_BODY=$MAIL_BODY"Please wstool update workspace manually\n"
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\n"
MAIL_BODY=$MAIL_BODY"Please catkin build workspace manually."
fi
LC_CTYPE=en_US.UTF-8 /bin/echo -e $MAIL_BODY | /usr/bin/mail -s "Daily workspace update fails" -r $(hostname)@jsk.imi.i.u-tokyo.ac.jp [email protected]

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 f46f638

Please sign in to comment.