I have a question about rc.local. I created a script auto.sh and it includes:
#!/bin/sh
cd $home
source /opt/ros/indigo/setup.bash
xterm -hold -e "/opt/ros/indigo/bin/roscore" &
xterm -hold -e "/opt/ros/indigo/bin/roslaunch rosbridge_server rosbridge_websocket.launch"
exit 0
My purpose is run to this script automatically using rc.local. rc.local file located at:
/etc/init.d/rc.local
rc.local file includes the code :
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sudo ./auto.sh
sh '/home/moguztas/auto.sh'
exit 0
This code is executable. I followed the steps at How can I make "rc.local" run on startup? .
But when I check the code using:
sudo /etc/init.d/rc.local start
it gives a error in terminal as given below:
./auto.sh: 4: ./auto.sh: source: not found
Also, in XTerm terminal errors are given like : error1 error2
Could you tell what is my problem ?
sh
on Ubuntu is the dash shell, not bash. It has no such command assource
– Zanna Apr 26 '17 at 10:13source
.. – Soren A Apr 26 '17 at 11:21