Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dstat supervisor job for Fetch #1825

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ 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

# copy config.bash to /var/lib/robo if not exists
if [ ! -e /var/lib/robot/config.bash ]; then
sudo cp $jsk_fetch_startup/config/config.bash /var/lib/robot/config.bash
Expand Down
14 changes: 14 additions & 0 deletions jsk_fetch_robot/jsk_fetch_startup/scripts/dstat.bash
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +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"
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