Index: xc/programs/Xserver/Xprint/etc/init.d/xprint =================================================================== RCS file: /cvs/xprint/xprint/src/xprint_main/xc/programs/Xserver/Xprint/etc/init.d/xprint,v retrieving revision 1.51 diff -u -2 -0 -r1.51 xprint --- a/xc/programs/Xserver/Xprint/etc/init.d/xprint 2 Jun 2004 19:23:00 -0000 1.51 +++ b/xc/programs/Xserver/Xprint/etc/init.d/xprint 9 Jun 2004 03:54:41 -0000 @@ -815,40 +815,125 @@ fi else echo ${display} fi ) done | tr "[\n]" " " ) # Only produce output if we have some entries... [ "${xpserverlist}" != "" ] && echo "${xpserverlist}" fi } do_restart() { msg "Restarting Xprint server(s): Xprt." do_stop sleep 1 do_start } +do_diag() +{ + echo "##### Diag start $(date)." + + # General info + echo "## General info start." + ( + echo "PATH=\"${PATH}\"" + echo "TZ=\"${TZ}\"" + echo "LANG=\"${LANG}\"" + echo "uname -a=\"$(uname -a)\"" + echo "uname -s=\"$(uname -s)\"" + echo "uname -p=\"$(uname -p)\"" + echo "uname -i=\"$(uname -i)\"" + echo "uname -m=\"$(uname -m)\"" + echo "has /etc/SuSE-release ... $([ -f "/etc/SuSE-release" ] && echo "yes" || echo "no")" + echo "has /etc/redhat-release ... $([ -f "/etc/redhat-release" ] && echo "yes" || echo "no")" + echo "has /etc/debian_version ... $([ -f "/etc/debian_version" ] && echo "yes" || echo "no")" + echo "how many Xprt servers are running ...$(ps -ef | fgrep Xprt | fgrep -v "grep" | wc -l)" + ) 2>&1 | while read i ; do echo " $i" ; done + echo "## General info end." + + # Testing font paths + echo "## Testing font paths start." + ( + get_system_fontlist | + filter_unsupported_fonts | + sort_scaleable_fonts_first | + validate_fontlist | while read d ; do + echo "#### Testing \"${d}\" ..." + if [ ! -d "$d" ] ; then + echo "# Error: $d does not exists." + continue + fi + if [ ! -r "$d" ] ; then + echo "# Error: $d not readable." + continue + fi + if [ ! -f "${d}/fonts.dir" ] ; then + echo "# Error: ${d}/fonts.dir not found." + continue + else + if [ ! -r "${d}/fonts.dir" ] ; then + echo "# Error: ${d}/fonts.dir not readable." + continue + fi + fi + if [ -f "${d}/fonts.alias" ] ; then + if [ ! -r "${d}/fonts.alias" ] ; then + echo "# Error: ${d}/fonts.alias not readable." + fi + fi + + if [ "$(cat "${d}/fonts.dir" | fgrep 'cursor')" != "" ] ; then + echo "${d}/fonts.dir has cursor font." + fi + if [ "$(cat "${d}/fonts.dir" | fgrep 'fixed')" != "" ] ; then + echo "${d}/fonts.dir has fixed font." + fi + + if [ -r "${d}/fonts.alias" ] ; then + if [ "$(cat "${d}/fonts.alias" | fgrep 'cursor')" != "" ] ; then + echo "${d}/fonts.alias has cursor font." + fi + if [ "$(cat "${d}/fonts.alias" | fgrep 'fixed')" != "" ] ; then + echo "${d}/fonts.alias has fixed font." + fi + fi + + linenum=0 + cat "${d}/fonts.dir" | while read i1 i2 i3 i4 ; do + linenum=$((${linenum} + 1)) + [ ${linenum} -eq 1 ] && continue + + if [ ! -f "${d}/${i1}" ] ; then + echo "ERROR: ${d}/fonts.dir line ${linenum} has non-exististant font \"${i1}\" (=\"${i1} ${i2} ${i3} ${i4}\")" + fi + done + done + ) 2>&1 | while read i ; do echo " $i" ; done + echo "## Testing font paths end." + + echo "##### Diag End $(date)." +} + # Set platform-defaults for setup_config() setup_config_defaults() { curr_num_xpstart="${1}" #### Defaults for Linux/Solaris # Start Xprt using builtin XPCONFIGDIR at a free display numer # (Solaris(=SunOS5.x)'s /usr/openwin/bin/Xprt supports TrueType fonts, # therefore we don't need to filter them) xpstart_fontpath[${curr_num_xpstart}]=""; xpstart_fontpath_acceptpattern[${curr_num_xpstart}]=".*"; xpstart_fontpath_rejectpattern[${curr_num_xpstart}]="/Speedo|/F3bitmaps|/F3"; xpstart_displayid[${curr_num_xpstart}]=""; xpstart_xpconfigdir[${curr_num_xpstart}]=""; xpstart_xpfile[${curr_num_xpstart}]=""; xpstart_auditlevel[${curr_num_xpstart}]="4"; xpstart_options[${curr_num_xpstart}]=""; xpstart_logger[${curr_num_xpstart}]=""; # Check whether we have /dev/stderr (needed for old AIX + old Debian) if [ -w "/dev/stderr" ] ; then @@ -1142,28 +1227,33 @@ shift ; shift export XPSERVERLIST="$(do_get_xpserverlist)" [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found." exec "${cmd}" "$@" ;; ## Wrapper for "xplsprinters" 'lsprinters') [ "${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" != "" ] && cmd="${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" [ "${cmd}" = "" -a "${XPCUSTOMGLUE}" = "GISWxprintglue" ] && cmd="/opt/GISWxprintglue/bin/xplsprinters" [ "${cmd}" = "" -a "${XPCUSTOMGLUE}" = "GISWxprint" ] && cmd="/opt/GISWxprint/bin/xplsprinters" [ "${cmd}" = "" -a "${XPROJECTROOT}" != "" ] && cmd="${XPROJECTROOT}/bin/xplsprinters" [ "${cmd}" = "" ] && cmd="xplsprinters" shift export XPSERVERLIST="$(do_get_xpserverlist)" [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found." exec "${cmd}" "$@" ;; + ## Diagnostics + 'diag') + do_diag + ;; + ## Print usage *) - msg "Usage: $0 { start | stop | restart | reload | force-reload | status | condrestart | try-restart | wrapper | lsprinters | get_xpserverlist }" + msg "Usage: $0 { start | stop | restart | reload | force-reload | status | condrestart | try-restart | wrapper | lsprinters | get_xpserverlist | diag }" exit 2 esac exit 0 # EOF.