Progamme Linux Autostart

Tue, 05/11/2013 - 22:07
Body

Sources

http://www.debian-administration.org/article/Making_scripts_run_at_boot_time_with_Debian http://www.debian-administration.org/articles/28 | GOOD http://drupal.org/node/507292

Beispiel: Solr

Erzeuge Datei
  1. sudo nano /etc/init.d/solr
File: Remember to change the SOLR_DIR to your directory
  1. #!/bin/sh -e
  2. # Starts, stops, and restarts solr
  3.  
  4. SOLR_DIR="/apache-solr-nightly/example"
  5. JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
  6. LOG_FILE="/var/log/solr.log"
  7. JAVA="/usr/bin/java"
  8.  
  9. case $1 in
  10. start)
  11. echo "Starting Solr"
  12. cd $SOLR_DIR
  13. $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
  14. ;;
  15. stop)
  16. echo "Stopping Solr"
  17. cd $SOLR_DIR
  18. $JAVA $JAVA_OPTIONS --stop
  19. ;;
  20. restart)
  21. $0 stop
  22. sleep 1
  23. $0 start
  24. ;;
  25.  
  26. echo "Usage: $0 {start|stop|restart}" >&2
  27. exit 1
  28. ;;
  29. esac
Chmod setzen (755):
  1. sudo chmod 755 /etc/init.d/solr
Skript linken:
  1. sudo update-rc.d solr defaults
Add new comment
The content of this field is kept private and will not be shown publicly.

Plain text

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.