From 12337671bfaa4eb04537b668e7cff66254994342 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Fri, 30 Apr 2021 01:09:45 +0900 Subject: [PATCH 1/7] Log dstat output --- .../supervisor_scripts/jsk-dstat.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf diff --git a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf new file mode 100644 index 0000000000..7ad426da83 --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf @@ -0,0 +1,11 @@ +; Install dstat +; sudo apt install dstat +[program:jsk-dstat] +command=/bin/bash -c "dstat -tcdgilmnprsTy" +stopsignal=TERM +autostart=true +autorestart=false +stdout_logfile=/var/log/ros/jsk-dstat.log +stderr_logfile=/var/log/ros/jsk-dstat.log +user=root +priority=1 From b7acd16c1083c7fd6ef8cc68035b4ce8aeff9035 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Thu, 6 May 2021 22:25:05 +0900 Subject: [PATCH 2/7] Show more CPU info in dstat output --- .../jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf index 7ad426da83..b6e61e99c7 100644 --- a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf +++ b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf @@ -1,7 +1,7 @@ ; Install dstat ; sudo apt install dstat [program:jsk-dstat] -command=/bin/bash -c "dstat -tcdgilmnprsTy" +command=/bin/bash -c "dstat -tl --cpufreq -c -C all --top-cpu-adv -dgimnprsTy" stopsignal=TERM autostart=true autorestart=false From 87380979fcdcfe84471853e09c5a26d9e889f949 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Thu, 20 May 2021 22:39:15 +0900 Subject: [PATCH 3/7] Save dstat output in csv format --- .../jsk_fetch_startup/config/install_supervisor.sh | 3 +++ .../jsk_fetch_startup/scripts/dstat.bash | 14 ++++++++++++++ .../supervisor_scripts/jsk-dstat.conf | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 jsk_fetch_robot/jsk_fetch_startup/scripts/dstat.bash diff --git a/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh b/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh index 9f77c428b9..095517cdb7 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh @@ -15,4 +15,7 @@ for file in $(ls ./*.conf); do echo "copied $file to /etc/supervisor/conf.d" done +# Enable jsk_dstat job to save the csv log under /var/log +ln -s /home/fetch/Documents/jsk_dstat.csv /var/log/ros/jsk_dstat.csv + set +x diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/dstat.bash b/jsk_fetch_robot/jsk_fetch_startup/scripts/dstat.bash new file mode 100755 index 0000000000..440237145e --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/dstat.bash @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Keep only the last 1000 lines of csv log before executing dstat +CSV_FILE=/home/fetch/Documents/jsk_dstat.csv + +if [ -e $CSV_FILE ]; then + cp -f $CSV_FILE $CSV_FILE.bk + tail -n 1000 $CSV_FILE.bk > $CSV_FILE + rm -f $CSV_FILE.bk +else + touch $CSV_FILE +fi + +dstat -tl --cpufreq -c -C all --top-cpu-adv -dgimnprsTy --output $CSV_FILE diff --git a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf index b6e61e99c7..4fcf56a3e3 100644 --- a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf +++ b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf @@ -1,7 +1,7 @@ ; Install dstat ; sudo apt install dstat [program:jsk-dstat] -command=/bin/bash -c "dstat -tl --cpufreq -c -C all --top-cpu-adv -dgimnprsTy" +command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && . /home/fetch/ros/melodic/devel/setup.bash && rosrun jsk_fetch_startup dstat.bash" stopsignal=TERM autostart=true autorestart=false From f783fe34b8c897cfbc614986a925ca314437ffc7 Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Thu, 22 Jun 2023 13:14:48 +0900 Subject: [PATCH 4/7] [jsk_fetch_startup] add rossetip to jsk_dstat.conf --- .../jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf index 4fcf56a3e3..90530aec0a 100644 --- a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf +++ b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf @@ -1,7 +1,11 @@ ; Install dstat ; sudo apt install dstat [program:jsk-dstat] -command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && . /home/fetch/ros/melodic/devel/setup.bash && rosrun jsk_fetch_startup dstat.bash" +command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && \ +. /home/fetch/ros/melodic/devel/setup.bash && \ +if [ -e /var/lib/robot/config.bash ];then . /var/lib/robot/config.bash ;fi && \ +rossetip $NETWORK_DEFAULT_WIFI_INTERFACE && \ +rosrun jsk_fetch_startup dstat.bash" stopsignal=TERM autostart=true autorestart=false From c0b67ede6e8b24c315d805eafd7384eee21f932f Mon Sep 17 00:00:00 2001 From: Koki Shinjo Date: Thu, 22 Jun 2023 13:19:17 +0900 Subject: [PATCH 5/7] [jsk_fetch_startup] fix jsk_dstat.conf --- .../jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf index 90530aec0a..da03912699 100644 --- a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf +++ b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf @@ -1,11 +1,7 @@ ; Install dstat ; sudo apt install dstat [program:jsk-dstat] -command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && \ -. /home/fetch/ros/melodic/devel/setup.bash && \ -if [ -e /var/lib/robot/config.bash ];then . /var/lib/robot/config.bash ;fi && \ -rossetip $NETWORK_DEFAULT_WIFI_INTERFACE && \ -rosrun jsk_fetch_startup dstat.bash" +command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && . /home/fetch/ros/melodic/devel/setup.bash && if [ -e /var/lib/robot/config.bash ];then . /var/lib/robot/config.bash ;fi && rossetip $NETWORK_DEFAULT_ROS_INTERFACE && rosrun jsk_fetch_startup dstat.bash" stopsignal=TERM autostart=true autorestart=false From acea63a9a0172514c5cdbb2cbb21620485f6cb92 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Thu, 26 May 2022 22:53:46 +0900 Subject: [PATCH 6/7] remove unnecessary lines --- .../jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf index da03912699..4fcf56a3e3 100644 --- a/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf +++ b/jsk_fetch_robot/jsk_fetch_startup/supervisor_scripts/jsk-dstat.conf @@ -1,7 +1,7 @@ ; Install dstat ; sudo apt install dstat [program:jsk-dstat] -command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && . /home/fetch/ros/melodic/devel/setup.bash && if [ -e /var/lib/robot/config.bash ];then . /var/lib/robot/config.bash ;fi && rossetip $NETWORK_DEFAULT_ROS_INTERFACE && rosrun jsk_fetch_startup dstat.bash" +command=/bin/bash -c ". /opt/ros/roscore_poststart.bash && . /home/fetch/ros/melodic/devel/setup.bash && rosrun jsk_fetch_startup dstat.bash" stopsignal=TERM autostart=true autorestart=false From 96fe6091e550f582f507c73afe32255253748ea8 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Wed, 2 Jun 2021 20:49:28 +0900 Subject: [PATCH 7/7] Fix typo --- jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh b/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh index 095517cdb7..81434844df 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/config/install_supervisor.sh @@ -16,6 +16,6 @@ for file in $(ls ./*.conf); do done # Enable jsk_dstat job to save the csv log under /var/log -ln -s /home/fetch/Documents/jsk_dstat.csv /var/log/ros/jsk_dstat.csv +ln -s /home/fetch/Documents/jsk_dstat.csv /var/log/ros/jsk-dstat.csv set +x