Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem ze skryptem exec i include
kefu
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 2.01.2011

Ostrzeżenie: (0%)
-----


Witam przejdę od razu do rzeczy napisałem malutki skrypcik który z poziomu www odpala proces na shellu ale nie działa i nie mam pomysłów jak to zastosować

Kod
  1. <?php
  2. system('cd /home/ts3/teamspeak3-server_linux-x86/');
  3. shell_exec('ts3server_startscript.sh start');
  4. echo '<font color="green">Serwer TS3 Zostal uruchomiony</font>';
  5. ?>


Drugim problemem jest ze apache nie czyta mi include w php i nie wiem co zrobić próbowałem już wszystkiego serwer stoi na starym komputerze jest on przeznaczony pod shella.

Za pomoc z góry dziękuję (IMG:style_emoticons/default/smile.gif)
Pozdrawiam Kefu.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kefu
post
Post #2





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 2.01.2011

Ostrzeżenie: (0%)
-----


Trochę tego jest :0

Skrypt który powinien uruchomić server
  1. <?php
  2. system("/bin/sh /home/ts/teamspeak3-server_linux-x86/ts3server_startscript.sh start");
  3. ?>


a tutaj plik ts3server_startscript.sh
  1. #!/bin/sh
  2. # Copyright (c) 2010 TeamSpeak Systems GmbH
  3. # All rights reserved
  4.  
  5. COMMANDLINE_PARAMETERS="${2}" #add any command line parameters you want to pass here
  6. BINARYPATH="$(dirname "${0}")"
  7. cd "${BINARYPATH}"
  8. LIBRARYPATH="$(pwd)"
  9.  
  10. if [ -e "ts3server_linux_x86" ]; then
  11. BINARYNAME="ts3server_linux_x86"
  12. elif [ -e "ts3server_linux_amd64" ]; then
  13. BINARYNAME="ts3server_linux_amd64"
  14. elif [ -e "ts3server_freebsd_x86" ]; then
  15. BINARYNAME="ts3server_freebsd_x86"
  16. elif [ -e "ts3server_freebsd_amd64" ]; then
  17. BINARYNAME="ts3server_freebsd_amd64"
  18. else
  19. echo "Could not locate binary file, aborting"
  20. exit 5
  21. fi
  22.  
  23. case "$1" in
  24. start)
  25. if [ -e ts3server.pid ]; then
  26. if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
  27. echo "The server is already running, try restart or stop"
  28. exit 1
  29. else
  30. echo "ts3server.pid found, but no server running. Possibly your previously started server crashed"
  31. echo "Please view the logfile for details."
  32. rm ts3server.pid
  33. fi
  34. fi
  35. if [ "${UID}" = "0" ]; then
  36. echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
  37. c=1
  38. while [ "$c" -le 10 ]; do
  39. echo -n "!"
  40. c=$((++c))
  41. done
  42. echo "!"
  43. fi
  44. echo "Starting the TeamSpeak 3 server"
  45. if [ -e "$BINARYNAME" ]; then
  46. if [ ! -x "$BINARYNAME" ]; then
  47. echo "${BINARYNAME} is not executable, trying to set it"
  48. chmod u+x "${BINARYNAME}"
  49. fi
  50. if [ -x "$BINARYNAME" ]; then
  51. export LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}"
  52. "./${BINARYNAME}" ${COMMANDLINE_PARAMETERS} > /dev/null &
  53. echo $! > ts3server.pid
  54. echo "TeamSpeak 3 server started, for details please view the log file"
  55. else
  56. echo "${BINARNAME} is not exectuable, cannot start TeamSpeak 3 server"
  57. fi
  58. else
  59. echo "Could not find binary, aborting"
  60. exit 5
  61. fi
  62. ;;
  63. stop)
  64. if [ -e ts3server.pid ]; then
  65. echo -n "Stopping the TeamSpeak 3 server"
  66. if ( kill -TERM $(cat ts3server.pid) 2> /dev/null ); then
  67. c=1
  68. while [ "$c" -le 300 ]; do
  69. if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
  70. echo -n "."
  71. else
  72. break
  73. fi
  74. c=$((++c))
  75. done
  76. fi
  77. if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
  78. echo "Server is not shutting down cleanly - killing"
  79. kill -KILL $(cat ts3server.pid)
  80. else
  81. echo "done"
  82. fi
  83. rm ts3server.pid
  84. else
  85. echo "No server runing (ts3server.pid is missing)"
  86. exit 7
  87. fi
  88. ;;
  89. restart)
  90. $0 stop && $0 start || exit 1
  91. ;;
  92. status)
  93. if [ -e ts3server.pid ]; then
  94. if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
  95. echo "Server is running"
  96. else
  97. echo "Server seems to have died"
  98. fi
  99. else
  100. echo "No server running (ts3server.pid is missing)"
  101. fi
  102. ;;
  103. *)
  104. echo "Usage: ${0} {start|stop|restart|status}"
  105. exit 2
  106. esac
  107.  
  108.  


Dałem te 2 najważniejsze!
Go to the top of the page
+Quote Post

Posty w temacie
- kefu   Problem ze skryptem exec i include   2.01.2011, 00:11:54
- - Krzychu105   a dlaczego od razu nie zrobisz ? Kodshell_exec...   2.01.2011, 01:42:46
- - kefu   Ponieważ to nic nie daje już próbowałem twojego ro...   2.01.2011, 02:49:44
- - MrMag   zobacz ten temat http://forum.php.pl/index.php?sho...   2.01.2011, 03:10:35
- - kefu   Nic nie dało niestety... ponieważ nie rozumie funk...   2.01.2011, 03:34:18
- - MrMag   pokaz kod   2.01.2011, 12:09:21
- - sazian   rozumiem że jeśli wpiszesz w konsoli Kod/home/ts3/...   2.01.2011, 15:08:58
- - kefu   Tak dobrze rozumiesz myślisz o stworzeniu pliku *....   2.01.2011, 17:20:21
- - sazian   nie, ja myślałem o stworzeniu pojedynczego pliku ...   2.01.2011, 19:58:40
- - kefu   Nie ma żadnego błędu ale w PHP to nie trybie nie w...   5.01.2011, 21:59:54
- - Hekko   A co jest w linii 2 ? Najlepiej to pokaż cały kod.   5.01.2011, 22:05:01
- - ZuyPan   Z tego co wiem taki błąd z include pojawia się gdy...   6.01.2011, 10:33:07
- - kefu   z include naprawiłem błąd to było przez kodowanie ...   6.01.2011, 12:27:34
- - MrMag   Cytat(kefu @ 2.01.2011, 17:20:21 ) Ta...   7.01.2011, 09:46:12
- - kefu   wszyscy którzy są na shellu przez 1 *.sh odpalam a...   7.01.2011, 10:09:49
- - MrMag   pokaz wszystko: kod php i skrypty sh   7.01.2011, 11:06:31
- - kefu   Trochę tego jest :0 Skrypt który powinien uruchom...   7.01.2011, 11:19:26
- - MrMag   bardzo nieuwaznie czytales ten temat zobacz [PH...   7.01.2011, 11:28:41
- - kefu   Nic nie dało nawet nie wyświetliło ze serwer się o...   7.01.2011, 11:33:31


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 14:00