From de62472bf8135cbb7a909d9d8a4d4081e0c29e03 Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Wed, 21 Apr 2021 17:12:05 +0900 Subject: [PATCH 1/3] Add cron install scripts --- .../jsk_fetch_startup/config/install_cron.sh | 15 +++++++++++++++ .../cron_scripts/cron_fetch.conf | 1 + .../jsk_fetch_startup/cron_scripts/cron_root.conf | 1 + .../jsk_fetch_startup/scripts/update_workspace.sh | 15 +++++++++++++++ 4 files changed, 32 insertions(+) create mode 100755 jsk_fetch_robot/jsk_fetch_startup/config/install_cron.sh create mode 100644 jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_fetch.conf create mode 100644 jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_root.conf create mode 100755 jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh diff --git a/jsk_fetch_robot/jsk_fetch_startup/config/install_cron.sh b/jsk_fetch_robot/jsk_fetch_startup/config/install_cron.sh new file mode 100755 index 0000000000..186b8dc4cc --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/config/install_cron.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +jsk_fetch_startup=$(builtin cd "`dirname "${BASH_SOURCE[0]}"`"/.. > /dev/null && pwd) + +IFS=':' read -r -a prefix_paths <<< "$CMAKE_PREFIX_PATH" +current_prefix_path="${prefix_paths[0]}" + +set -x + +cd $jsk_fetch_startup/cron_scripts +sudo -u fetch crontab cron_fetch.conf +echo "Set cron jobs for fetch user" +sudo -u root crontab cron_root.conf +echo "Set cron jobs for root user" +set +x diff --git a/jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_fetch.conf b/jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_fetch.conf new file mode 100644 index 0000000000..839bc9e138 --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_fetch.conf @@ -0,0 +1 @@ +0 3 * * * bash -c ". /home/fetch/ros/melodic/devel/setup.bash && rosrun jsk_fetch_startup update_workspace.sh &> /home/fetch/ros/melodic/update_workspace.log" diff --git a/jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_root.conf b/jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_root.conf new file mode 100644 index 0000000000..da33972f7e --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/cron_scripts/cron_root.conf @@ -0,0 +1 @@ +0 4 * * * /sbin/shutdown -r now diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh new file mode 100755 index 0000000000..d36f2b8ea5 --- /dev/null +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +. $HOME/ros/melodic/devel/setup.bash + +set -x + +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 +cd $HOME/ros/melodic +catkin init +catkin config -DCMAKE_BUILD_TYPE=Release +catkin build +set +x From 733178ceda50aec6c4befb638c5f846e3a4a6fde Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Tue, 27 Apr 2021 17:15:32 +0900 Subject: [PATCH 2/3] catkin clean workspace after wstool update --- jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index d36f2b8ea5..d8c2f7e8a6 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -9,6 +9,7 @@ ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $HO wstool foreach --git 'git stash' wstool update --delete-changed-uris cd $HOME/ros/melodic +catkin clean -y catkin init catkin config -DCMAKE_BUILD_TYPE=Release catkin build From 5fffc1b794413b86b534846f243a8980296152bc Mon Sep 17 00:00:00 2001 From: Naoya Yamaguchi <708yamaguchi@gmail.com> Date: Tue, 27 Apr 2021 17:39:02 +0900 Subject: [PATCH 3/3] catkin clean only specified packages --- jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh index d8c2f7e8a6..e5a05ef02b 100755 --- a/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh +++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/update_workspace.sh @@ -9,7 +9,7 @@ ln -sf $(rospack find jsk_fetch_startup)/../jsk_fetch.rosinstall.$ROS_DISTRO $HO wstool foreach --git 'git stash' wstool update --delete-changed-uris cd $HOME/ros/melodic -catkin clean -y +catkin clean aques_talk collada_urdf_jsk_patch -y catkin init catkin config -DCMAKE_BUILD_TYPE=Release catkin build