Help - Search - Members - Calendar
Full Version: Auto Start A Program
Linuxhelp > Support > Technical Support
Thors1982
I am a huge linux newb, I took a course in linux but it didn't help at all.
I am trying to run a program when Linux starts

I am using Mandrake 10.0 with KDE

I am trying to run a program called Synergy, the way I currently run the program is I open the shell and type "synergyc -f 192.169.1.100" then it runs. Is there anyway that I can run this program automatically and if so how? Again I am a newb so more desciprive the better :-)

Thanks
hughesjr
Ok .... here is a script that should make it start (do all the commands as root):

paste this into a text file named /etc/init.d/synergy

CODE
#!/bin/sh
#
# Synergy:       Starts Synergy
#
# Version:      @(#) /etc/rc.d/init.d/synergy 1.0
#
# chkconfig: 2345 80 20
# description: Starts and stops Synergy at boot time and shutdown.
#
# processname: Synergy
# config:
# hide: true

# Source function library.
. /etc/rc.d/init.d/functions

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

# See how we were called.
case "$1" in
 start)
    gprintf "Starting Synergy: "
    synergyc -f 192.169.1.100
    touch /var/lock/subsys/synergy
    echo
;;
 stop)
    gprintf "Stopping Synergy: "
    killproc synergyc
    rm -f /var/lock/subsys/synergy
    echo
;;
 restart)
    gprintf "Restarting Synergy"
    if [ -f /var/lock/subsys/synergy ]; then
    killproc synergyc
    else
    synergyc -f 192.169.1.100
    touch /var/lock/subsys/xfs
    fi
    echo
;;
 *)
    gprintf "*** Usage: synergy {start|stop|restart}n"
    exit 1
esac

exit 0


After saving it, make it executeable with the command:

chmod 755 /etc/init.d/synergy

then make it start on startup and shutdown with the commands:

chkconfig --level 2345 synergy on
chkconfig --level 016 synergy off
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.