I'm trying to write a batch script that creates new terminator terminals and then runs a process in each one. I want them to keep running in the background until I decide to kill them.
I want the first one to run for 10 seconds and then afterwards create a bunch of other terminator processes simultaneously.
This first part far works but now I want to, at the end, be able to press enter and send a SIGINT to every process that I started. I can't figure out a command that works for this purpose.
#!/bin/sh echo "Running Teleop... (MAY TAKE SEVERAL SECONDS TO INITIALIZE)" terminator -T "gazebo" -e "roslaunch cob_bringup_sim robot.launch robot:=cob4-8 robot_env:=ipa-apartment; bash" & #wait 10 secons before starting nav and rviz otherwise will get error ((sleep 10) && (terminator -T "navigation" -e "roslaunch cob_navigation_global 2dnav_ros_dwa.launch robot:=cob4-5 robot_env:=ipa-apartment; bash" & terminator -T "rviz" -e "roslaunch cob_navigation_global rviz.launch; bash" & terminator -T "arm_controller" -e "roslaunch cob_moveit_bringup demo.launch rviz_tutorial:=true robot:=cob4-8; bash" & terminator -T "control_nodes" -e "cd catkin_ws; rosrun first_pkg control_nodes; bash" & terminator -T "controller" -e "cd catkin_ws; rosrun first_pkg controller; bash" & terminator -T "joystick" -e "rosrun joy joy_node; bash" & #spawn objects terminator -T "spawn_objects_launch" -e "roslaunch cob_default_env_config upload_object_locations.launch robot_env:=ipa- apartment; rosrun cob_bringup_sim spawn_object.py tomato_sauce; bash")) & ( echo Press any key to to shutdown all processes read varname echo Shutting down... #terminating all child processes )
These are ROS commands but I assume there is no difference between them and generic commands in this case. I realize the code is quite messy and if there are any other issues you see with it I'd be glad to hear it. Thanks!