Results 1 to 6 of 6

Thread: Would like to make a bash script for auto start the progamme

  1. #1
    Join Date
    Oct 2012
    Beans
    4

    Question Would like to make a bash script for auto start the progamme

    I have Ubuntu 12.04lts there is folder in my home called FlexHub in which there is a file which first loads lua and then the file ( ./lua ./FlexHub.lua )
    I always have to cd FlexHub then give command ./lua /FlexHub in terminal
    rather i would like to switch to tty1 and login and the script auto loads the flexhub
    this is used for non gui ./lua ./FlexHub.lua --nogui
    I am new be in linux i have no knowledge of bash thoug i tried to find out from google but i could make it.Can some one help me out in this ?
    If possible plz give step by step that would be good so i wont make mistake and then come knocking again

  2. #2
    Join Date
    Nov 2009
    Beans
    Hidden!

    Re: Would like to make a bash script for auto start the progamme

    For the TTY, you can put the command in

    ~/.bashrc

    Like this:

    Code:
    if [[ $- = *i* ]] ; then
    	FlexHub/lua FlexHub/FlexHub.lua --nogui
    fi
    For X sessions, you can use the DE's startup manager to load it. Or, maybe with the use of .xsession, like this:

    Code:
    FlexHub/lua FlexHub/FlexHub.lua &
    linux-git/fs/super.c: "Self-destruct in 5 seconds. Have a nice day...\n",

  3. #3
    Join Date
    Oct 2012
    Beans
    4

    Unhappy Re: Would like to make a bash script for auto start the progamme

    Well how can i make a boot script in init.d which can boot at everytime when it is either rebooted or kept on ? flexhub should start with nongui that would be done in setting

  4. #4
    Join Date
    Nov 2009
    Beans
    Hidden!

    Re: Would like to make a bash script for auto start the progamme

    That was not your initial question, why would you want this?

    It's not safe to execute programs and scripts as root that reside in a user directory.
    linux-git/fs/super.c: "Self-destruct in 5 seconds. Have a nice day...\n",

  5. #5
    Join Date
    Oct 2012
    Beans
    4

    Cool Re: Would like to make a bash script for auto start the progamme

    I wanted this as i login in ttyl1 i dont need to type cd FlexHub and then teh command instead when i log in i need to auto start i tried GUI but it dint worked as once i can run this i will turn to nongui.

  6. #6
    Join Date
    Oct 2012
    Beans
    4

    Re: Would like to make a bash script for auto start the progamme

    This is what i have written started with all bin bash i have not written that

    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    DESC="FlexHub"
    NAME=FlexHub.sh
    USER=nameofuser
    DIR=/home/$username/Flexhub/ # path to flexhub dir
    SCRIPTNAME=/etc/init.d/$NAME

    set -e

    # Gracefully exit if the package has been removed.
    test -x $DAEMON || exit 0

    if [ "$1" = "start" ]; then
    ping -c 1 google.com
    if [ $? != 0 ]; then
    sleep 30
    fi
    fi
    cd $DIR
    sudo -u $USER ./lua ./FlexHub.sh --nogui

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •