Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know that i can go under system-> preferences -> startup to add in application that i want to autostart when fedora starts. But if my application requires to open terminal then type ./[appname] inorder to execute it, what should i type in the command field in the auto start section such that it will auto run at terminal upon os starts? thanks!

share|improve this question
    
related: stackoverflow.com/questions/1728878/… –  Warren P Mar 13 '12 at 2:43
    
deleted =)))))) –  user1157977 Mar 13 '12 at 2:44
    
Warren P: how can i create the .desktop file? –  user1157977 Mar 13 '12 at 2:57
add comment

1 Answer

According to this and this, the procedure to run a script on boot for Fedora is as follows:

1: Create a bash script to do what you want, in form of

#!/bin/bash
# chkconfig: 345 91 19
# description: Script to do what I want.

OWNER="myusername" # The user you want ot run the script as

case "$1" in
    start)
        echo -n "Starting Myscript: "
        #Your command follows:
        su - $OWNER -c "/usr/local/bin/myscript"
        #or possibly:
        su - $OWNER -c "screen -d -m -S myscript /usr/local/bin/myscript"
        echo $? > /var/lock/myscript
        echo "OK"
        ;;
    stop)
        echo -n "Shutdown Myscript: "
        kill $(cat /var/lock/myscript)
        rm -f /var/lock/myscript
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;  
    *)
        echo "Usage: $0 start|stop|restart|reload"
        exit 1
esac
exit 0

and save it as /etc/init.d/myscript.

2: Run as root: chkconfig --add myscript

3: Run as root: sudo ntsysv

You can then reboot or run service myscript start to start it. If you chose to run it through screen, you can get access to the program with screen -r myscript.

Note that I haven't tested this since I use Gentoo which has a different init system, so details and spelling might be off. Have fun!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.