Revision [13258]

This is an old revision of DaemonEinrichtenDebian made by ToBo on 2012-03-17 21:10:21.

 

Daemon einrichten


Einen neuen Daemon unter Debian einzurichten ist für Anfänger eine keine Herausforderung.


/etc/init.d/autobackup
#! /bin/sh
# Andreas Tobola, 2012

# The name of the deamon
DAEMON=autobackup

touch /var/lock/$DAEMON

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    start-stop-daemon --background --start --pidfile /var/run/$DAEMON.pid --make-pidfile --exec /home/root/backup/usbautobackup.sh
    echo "USB bar auto backup daemon started."
    ;;
  stop)
    start-stop-daemon --stop --pidfile /var/run/$DAEMON.pid
    echo "USB bar auto backup daemon stoped."
    ;;
  *)
    echo "Usage: /etc/init.d/$DAEMON {start|stop}"
    exit 1
    ;;
esac

exit 0



Geeignete Rechte setzen
chmod 755 /etc/init.d/autobackup



Das Skript zumindest unter dem aktuellen Runlevel verlinken. Mit dem Befehl runlevel, lässt sich herausfinden in welchem Runlevel das System im Normalfall arbeitet. Für Runlevel 2 wechselt man in das Verzeichnis /etc/rc2.d/. Für Runlevel 3 entsprechend /etc/rc3.d/.
cd /etc/rc2.d/
ln -s /etc/init.d/autobackup S80autobackup
ln -s /etc/init.d/autobackup K80autobackup





Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki