I am using ubuntu in rapsberry pi 2. I want my script to be ran after I login because it is a GUI program. I have tried to edit /etc/profile and it runs the program before enter the desktop so it cause some of the GUI failed to run. Therefore, I tried to use crontab and it works but I faced some problems.
Here is the line I appended into crontab.
@reboot sh /home/ubuntu/testing.sh >/home/ubuntu/logs/cronlog 2>&1
Here is my script.
#!/bin/bash source /home/ubuntu/ros_package/devel/setup.bash roslaunch uvc_camera camera_node.launch & source /home/ubuntu/catkin_ws/devel/setup.bash rosrun hybrid_tracking ir_track
Here is my output log.
/home/ubuntu/testing.sh: 3: /home/ubuntu/testing.sh: source: not found
/home/ubuntu/testing.sh: 20: /home/ubuntu/testing.sh: source: not found
/home/ubuntu/testing.sh: 4: /home/ubuntu/testing.sh:
/home/ubuntu/testing.sh: 21: /home/ubuntu/testing.sh: rosrun: not found roslaunch: not found
I have tested my script and it is running in terminal but why there are errors when I run it in cron?