Ubuntu: Why is my terminal starting with $?


I have a crontab that runs a shell Script. The shell script contains codes to create tmux and launch some commands.

@reboot /home/netforce/scripts/script.sh > /dev/null  

The Following is contents of script:

#!/bin/bash  sess=erp    if [ "`tmux ls | grep $sess`" != "" ]  ; then       echo "session $sess already running"     exit 1  fi    echo "starting session"    tmux new-session -d -s erp  tmux rename-window 'server'  tmux send-keys 'supervise ~/svc/netforce' 'C-m'  sleep 2  

Well things do work , tmux is created and software is running .

But is running with

$ ./run.py  

It should be running as

netforce@netforce-computer:~/netforce$ ./run.py  

Why i want to run as above? It works okay for the main run comand but. I have multiple windows eg for print that use shell script (and it doesnot work)

When i run the script.sh manually it works perfectly though.

From little research i came to know the bash profile is not loaded. But i have no clue how to launch with my bash environment (.bashrc ? i suppose).

Any suggestion is very much appreicated.


My updated crontab is

SHELL=/bin/bash  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin    @reboot sleep 60 && /home/netforce/asus_scripts/start-erp.sh > /dev/null  #* */4 * * * /home/netforce/backup/backup_db.py  

Some python files are working but some have issue due to the bash. When i echo $0 i receive -bash . This is not my normal bash .

When i open a new terminal and type echo $0 i receive -bash (This is correct).And the python files are working correctly. Any suggestion is much appreciated.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »