You are not logged in.

#1 2007-03-13 09:20:52

Flasher
Member
From: Bavaria / Germany
Registered: 2005-04-24
Posts: 126

Are there any sample init-script?

Hello,

I switched my server vom debian to arch during last week. The server has a special RAID-Controller (3ware 9650 SE) with a special maintaince-Applikation.

For this application I want to make a arch-package. The app runs normally as a deamon. Under debian I modified a sample init-script and it works smile

But in arch-linux I can't find any sample init-script, which I can modify. The rc.d folder contains some scripts but they all different and seems to be very complicated wink

Has anybody a simple init-script, to start, stop and restart a small application?

Thanks for help smile

Greetings,

Flasher

Offline

#2 2007-03-13 10:01:46

tri
Member
Registered: 2007-02-22
Posts: 4

Re: Are there any sample init-script?

Hi Flasher,
if i get it right, your app will run as a deamon ? Yes - so why not simply create a script inside /etc/rc.d ?

An example script:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID /usr/bin/"YOURAPP"`
case "$1" in
  start)
    stat_busy "Starting "YOURAPP" Daemon"
    [ -z "$PID" ] && /usr/bin/"YOURAPP" &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      echo $PID > /var/run/"YOURAPP" .pid
      add_daemon "YOURAPP"
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping "YOURAPP"  Daemon"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /var/run/"YOURAPP" .pid
      rm_daemon "YOURAPP" 
      stat_done
    fi
    ;;
   restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Modifi this file for your needs and save it as ""YOURAPP"; make the file executable and have fun ;-)

Hope this helps ?

Best regards,
Tobi

--
Tobias 'tri' Richter
Visit me at: http://opt.imi.st

Offline

#3 2007-03-13 11:28:59

Flasher
Member
From: Bavaria / Germany
Registered: 2005-04-24
Posts: 126

Re: Are there any sample init-script?

Thank you very much!

Da du auch deutsch sprichst ;-) Genau das habe ich gebraucht! Ich hab mich wohl mit dieser deamon Angelegenheit etwas umständlich ausgedrückt!

Danke!

Güße,

Flasher

Offline

Board footer

Powered by FluxBB