SSH foutcodes
Ik heb een server met ssh toegang en wil graag een script uitvoeren op de server. Maar wanneer ik de command heb ingetypt krijg ik het bericht:
Code (php)
1
2
3
2
3
De opdracht '"./teamspeak2-server_startscript"'
gaf foutcode 2 terug, samen met de foutmelding
.
gaf foutcode 2 terug, samen met de foutmelding
.
Ik heb echter geen flauw idee wat ik er mee moet of wat het betekent.
Ik gebruik nu het programma "WinSCP" maar dit programma gebruikt echter weer Putty, dus eigenlijk werk ik gewoon met Putty.
Hieronder ook nog het script zelf:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
# Copyright (c) 2004 TeamSpeak team All rights reserved.
#
# Author: pwk.linuxfan 2004
#
case "$1" in
start)
if [ -e tsserver2.pid ]; then
echo "tsserver2.pid already exists...server already started ?";
echo "If you are sure the server is not running, delete tsserver2.pid"
exit 1
else
if [ "$UID" = "0" ]; then
echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
for c in $(seq 1 10); do
echo -n "!"
sleep 1
done
echo !
fi
echo "starting the teamspeak2 server"
if [ -e server_linux ]; then
if [ ! -x server_linux ]; then
echo "server_linux is not executable, trying to set it"
chmod u+x server_linux
fi
if [ -x server_linux ]; then
./server_linux -PID=tsserver2.pid
else
echo "server_linux is not executable, fix this"
exit 4
fi
else
echo "Couldnt find server_linux"
exit 5
fi
fi
;;
stop)
if [ -e tsserver2.pid ]; then
echo -n "stopping the teamspeak2 server"
if ( kill -TERM `cat tsserver2.pid` ); then
for c in $(seq 1 300); do
if [ -e tsserver2.pid ]; then
echo -n "."
sleep 1
fi
done
fi
if [ -e tsserver2.pid ]; then
echo "server does not shutdown cleanly - killing"
kill -KILL `cat tsserver2.pid`
rm tsserver2.pid
sleep 5
else
echo "done"
fi
else
echo "tsserver2.pid is missing, no started server ?"
exit 7
fi
;;
restart)
$0 stop && $0 start || exit 1
;;
status)
if [ -e tsserver2.pid ]; then
echo "the server seems to be running"
exit 0
else
echo "the server seems to be stopped"
exit 3
fi
;;
passwords)
if [ -e server.log ]; then
date=$(cat server.log | grep "admin account info: username: admin" | tail -n 1 | sed "s/^\([0-9]\+-[0-9]\+-[0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+\).*$/\1/")
spass=$(cat server.log | grep "superadmin account info: username: superadmin" | tail -n 1 | sed "s/^.*username: superadmin password: \([a-z0-9]\+\).*$/\1/")
pass=$(cat server.log | grep "admin account info: username: admin" | tail -n 1 | sed "s/^.*username: admin password: \([a-z0-9]\+\).*$/\1/")
echo "Following passwords were generated on $date"
echo "superadmin = \"$spass\""
echo "admin = \"$pass\""
else
echo "server.log not found, maybe you did not start the server yet ?"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status|passwords}"
exit 2
esac
exit 0
# Copyright (c) 2004 TeamSpeak team All rights reserved.
#
# Author: pwk.linuxfan 2004
#
case "$1" in
start)
if [ -e tsserver2.pid ]; then
echo "tsserver2.pid already exists...server already started ?";
echo "If you are sure the server is not running, delete tsserver2.pid"
exit 1
else
if [ "$UID" = "0" ]; then
echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
for c in $(seq 1 10); do
echo -n "!"
sleep 1
done
echo !
fi
echo "starting the teamspeak2 server"
if [ -e server_linux ]; then
if [ ! -x server_linux ]; then
echo "server_linux is not executable, trying to set it"
chmod u+x server_linux
fi
if [ -x server_linux ]; then
./server_linux -PID=tsserver2.pid
else
echo "server_linux is not executable, fix this"
exit 4
fi
else
echo "Couldnt find server_linux"
exit 5
fi
fi
;;
stop)
if [ -e tsserver2.pid ]; then
echo -n "stopping the teamspeak2 server"
if ( kill -TERM `cat tsserver2.pid` ); then
for c in $(seq 1 300); do
if [ -e tsserver2.pid ]; then
echo -n "."
sleep 1
fi
done
fi
if [ -e tsserver2.pid ]; then
echo "server does not shutdown cleanly - killing"
kill -KILL `cat tsserver2.pid`
rm tsserver2.pid
sleep 5
else
echo "done"
fi
else
echo "tsserver2.pid is missing, no started server ?"
exit 7
fi
;;
restart)
$0 stop && $0 start || exit 1
;;
status)
if [ -e tsserver2.pid ]; then
echo "the server seems to be running"
exit 0
else
echo "the server seems to be stopped"
exit 3
fi
;;
passwords)
if [ -e server.log ]; then
date=$(cat server.log | grep "admin account info: username: admin" | tail -n 1 | sed "s/^\([0-9]\+-[0-9]\+-[0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+\).*$/\1/")
spass=$(cat server.log | grep "superadmin account info: username: superadmin" | tail -n 1 | sed "s/^.*username: superadmin password: \([a-z0-9]\+\).*$/\1/")
pass=$(cat server.log | grep "admin account info: username: admin" | tail -n 1 | sed "s/^.*username: admin password: \([a-z0-9]\+\).*$/\1/")
echo "Following passwords were generated on $date"
echo "superadmin = \"$spass\""
echo "admin = \"$pass\""
else
echo "server.log not found, maybe you did not start the server yet ?"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status|passwords}"
exit 2
esac
exit 0
Alvast bedankt voor de hulp!
"Usage: $0 {start|stop|restart|status|passwords}"
Waarschijnlijk moet je gewoon "./teamspeak2-server_startscript start" intypen.
Jelmer schreef op 14.05.2008 18:16:
Probeer eens via Putty in te loggen, dan krijg je waarschijnlijk de melding te zien:
"Usage: $0 {start|stop|restart|status|passwords}"
Waarschijnlijk moet je gewoon "./teamspeak2-server_startscript start" intypen.
"Usage: $0 {start|stop|restart|status|passwords}"
Waarschijnlijk moet je gewoon "./teamspeak2-server_startscript start" intypen.
Ook dit werkt helaas niet, ik zou eigenlijk al tevreden wezen met te weten wat er precies fout gaat.
Misschien dat het aan WinSCP ligt, maar wanneer je inlogt met putty, en dus gewoon direct in de console werkt, dan zou "./script start" voldoende moeten zijn.
Ik denk dat ik weer een andere server moet zoeken.