LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Autostart for an Dynipclient Executable (https://www.linuxquestions.org/questions/linux-newbie-8/autostart-for-an-dynipclient-executable-2688/)

Raygun 05-22-2001 10:23 AM

To start my dynipclient executable I have to start it in a terminal console. Usually by ./dynipclient.
How would get it to run when I start up Mandrake 8?
I would like to autostart similar to windows.

Any suggestions?

unSpawn 05-22-2001 11:03 AM

The ideal way would be to use runlevel scripts.
Put script as /etc/rc.d/init.d/runDynip & make executable.
now on the commandline link it to the runlevel u start in (say 3):
ln -s /etc/rc.d/init.d/runDynip /etc/rc.d/rc3.d/SrunDynip
or in X use mandrake's Sysv Init editor.

#cut below & replace underscores to spaces
#!/bin/sh
#set location of the app to run or else well
# have to find it ourselves...
#APP=/usr/local/bin/dynipclient
APP=$(whereis dynipclient | gawk '{print $2}')

if [ -f /etc/rc.d/init.d/functions ]; then
# Dont know if Meandork uses functions :-]
____. /etc/rc.d/init.d/functions
____USEF=1
else
# Just make sure were not off some path
____P=$(whereis pidof | gawk '{print $2}')
____K=$(whereis kill | gawk '{print $2}')
____USEF=0
fi

case "$1" in
___start)
________if [ $USEF = 1 ]; then
________daemon $APP
________else
________nohup $APP &
________fi
________echo "DynIP Client started"
________;;
____stop)
________if [ $USEF = 1 ]; then
________killproc $APP
________else
________# or kill -s TERM $(pidof dynipclient)
________$K -s TERM $($P $APP)
________fi
________echo "DynIP Client stopped"
________;;
_______*)
________echo "runDynip [start|stop]"
________exit 1
esac

exit 0
#cut above

now itll run on startup or u can run it like (path to)RunDynip start/stop

*btw, be carefull with scripts u didnt write ureself

Raygun 05-22-2001 11:30 AM

unSpawn,
Thanks for the help.
Can you make your instructions a little simpler?
I am not very knowledgable with scripts.
Thanks

unSpawn 05-22-2001 01:37 PM

argh. and I thought I made it easy :-]

ok. copy everything between the marks "cut below" and "cut above" to a file named RunDynip. open your favourite editor and replace the underscores with spaces, or open an xterm window, locate the file RunDynip. All commands below should be run without quoting and each on its own line!
This will replace the underscores, copy, make executable, and link to the default runlevel u start in.

"cat RunDynip | sed -e "s/_/ /g" > RunDynip"
"cp RunDynip /etc/rc.d/init.d/runDynip"
"chmod 0750 /etc/rc.d/init.d/runDynip"
"cat /etc/inittab | grep initdefault | sed -e "s/:/ /g" | gawk '{print $2}'"
now take note from the number it just printed, u will insert it in the place of the # in the line below:
"ln -s /etc/rc.d/init.d/runDynip /etc/rc.d/rc#.d/SrunDynip"



All times are GMT -5. The time now is 12:29 PM.