I have to run a bash script on bootup which opens couple of terminals and runs some command in each terminal.
test.sh (My bash file)
#!/bin/bash
sleep 10
gnome-terminal --tab-with-profile="Default" -e 'bash -c '\''export TAB=1; mkdir /home/naman/Desktop/test_folder'\'
- I have created a
testjob.conf
inside/etc/init/
:
testjob.conf (Upstart config file)
description "A test job file for experimenting with Upstart"
author "Naman Kumar"
start on runlevel [2345]
exec echo Test Job ran at `date` >> /var/log/testjob.log
exec bash /home/naman/Desktop/test.sh
Now, the problem is testjob.conf
is not able to run the test.sh
file on bootup (or it runs it but does not create a folder test_folder
). If I remove the last line from testjob.conf : exec bash /home/naman/Desktop/test.sh
, everything works and when I do cat /var/log/testjob.log
, I get the correct output but if the last line is there, cat /var/log/testjob.log
does not give the latest output.
- I have also tried updating
/etc/rc.local
with :bash /home/naman/Desktop/test.sh
but that also does not seem to be running thetest.sh
script on bootup
I am not sure whether they run the scripts but are not able to create the folder or they are not even able to run the script on bootup.
Note: I can not use System -> Preferences -> Startup Applications
because I don't have any monitor, so the desktop application does not run. (I am running it on a Single Board Computer with no monitor).
Does anyone know what is the issue here and why is the test.sh script not running properly on bootup?
Thanks in advance.
Naman