Skip to content

Commit

Permalink
[ros_bridge][QNX log fetch] Fetch only the files that match the speci…
Browse files Browse the repository at this point in the history
…fic dates expr.

Ideally "date-after x" feature would have been useful, but looks like for tar command on QNX 6.5.0, none of date specifier option does not work, and implementing custom date query is a bit cumbersome now.
  • Loading branch information
130s committed Jun 1, 2017
1 parent 863700e commit b87a73a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hironx_ros_bridge/robot/qnx_fetch_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
function usage {
echo >&2 "usage: $1 [hostname (default:nextage)]"
echo >&2 " $2 [ossuser_qnx (default:tork)]"
echo >&2 " $3 [date_specifier (default:none. Format: yyyymmdd, or it can be partial, e.g. yyyymm. Searches the files whose name matches the given string.)]"
echo >&2 " [-h|--help] Print help message."
exit 0
}
Expand All @@ -27,6 +28,8 @@ hostname=$1
hostname=${hostname:="nextage"}
ossuser_qnx=$2
ossuser_qnx=${ossuser_qnx:="tork"}
date_specifier=$3
date_specifier=${date_specifier:=""} # By default this isn't set, so fetch files for all dates.
OSS_FOLDER='/opt/jsk'
OSS_FOLDER_LOG=${OSS_FOLDER}/var/log
DATE=`date +"%Y%m%d-%H%M%S"`
Expand All @@ -47,7 +50,7 @@ commands="
set +x;
echo '* Create tarball of ${OSS_FOLDER_LOG} *';
tar cfvz opt_jsk_var_logs_${DATE}.tgz ${OSS_FOLDER_LOG}/* || echo '* Failed to create tarball *';
tar cfvz opt_jsk_var_logs_${DATE}.tgz ${OSS_FOLDER_LOG}/*${date_specifier}* || echo '* Failed to create tarball *';
echo '* Exitting ssh session to QNX. *';
exit;
Expand Down

0 comments on commit b87a73a

Please sign in to comment.