Remi
January 16, 2007, 10:19am
1
Hello...
I'm trying to run the sshd script, but I keep geting the Syntax errot message .
Here's the last few lines on the script. set nu in vi shows 58 lines, but I keep getting error referring to line 59. Any help is appreciated.
Thanks,
Remi
else
echo "SSH server is not running!" ;
fi
;;
*)
echo "Usage: sshd {start|stop|restart|status}"
exit 1
esac
exit 0
# EOF
"sshd" 58 lines, 1501 characters
# cd ..
# pwd
/etc
# cd rc2.d
# ./S98sshd start
./S98sshd: syntax error at line 59: `end of file' unexpected
#
It detected the error because it hit eof before it found something it needed. One possibility: a line that should read
var="data"
is missing one of the quotes. And the line could be anywhere in the file.
Remi
January 16, 2007, 1:25pm
3
This is the full script....I still can't seem to figure out what's missing.
Thanks,
Remi
#!/bin/sh$
#$
# OpenSSH startup script$
#$
# Tested on Solaris 8$
#$
$
sshconf=/usr/local/etc/sshd_config$
$
[ -f /usr/local/sbin/sshd ] || exit 0$
$
# See how we were called.$
$
case "$1" in$
start)$
# Start daemons.$
# check if sshd is running [1] or not [0]$
#num=`ps -elf|grep /usr/local/sbin/sshd |grep root|grep -v $
grep|wc -l|cut -c 8`$
#if [ "$num" = "0" ] ;$
if [ -r /var/run/sshd.pid ] ; then$
echo "There are one or more sshd instances $
running, please stop them manually";$
else$
echo "Starting sshd using $sshconf "$
/usr/local/sbin/sshd -f $sshconf$
echo "forked at Pid `cat /var/run/sshd.pid`"$
echo "done." ;$
fi$
;;$
stop)$
# Stop daemons.$
# checking if there is pid available$
[ -f /var/run/sshd.pid ] || exit 0$
$
echo "Shutting down sshd..." $
kill `cat /var/run/sshd.pid`$
echo "done."$
;;$
restart)$
$0 stop$
$0 start$
;;$
status)$
if [ -r /var/run/sshd.pid ] ; then$
echo "Ssh is currently forked at Pid `cat $
/var/run/sshd.pid` and ready to serve requests"$
else$
echo "SSH server is not running!" ;$
fi$
;;$
*)$
echo "Usage: sshd {start|stop|restart|status}"$
exit 1$
esac$
$
exit 0$
# EOF$
Remi
January 16, 2007, 1:28pm
4
The $ at the end of the scripts - due to the set list command.
Thanks Again
#num=`ps -elf|grep /usr/local/sbin/sshd |grep root|grep -v $
grep|wc -l|cut -c 8`$
It looks like a newline got inserted here. The backquote on the first line is now ignored as part of a comment. The backquote on the second line will be expected to have a mate somewhere.