[Wine] Script to run Wine and save log

Gert van den Berg wine-users at mohag.net
Wed Jun 24 14:38:04 CDT 2009


Hi all,

I created as little script to run wine and automatically log the
output and some basic information to a file.

It can be downloaded from here: http://www.mohag.net/wine_with_log

How to use:
1. Download (or create) it somewhere and set it executable.
wget http://www.mohag.net/wine_with_log
chmod +x wine_with_log

2. Run application with wine_with_log rather than wine
3. Logs can be found in the wine-logs subdirectory (Filenames:
<command>.<date>.<wine version>.log)

It attempts to run wine-git from ~/wine-git/wine first, followed by
wine from /usr/local, then wine from /usr and finally the default wine
(no path specified).

It adds some general information about the environment that it is used
in at the top of the log. Please check this information before
uploading / publishing the log publicly to ensure that it contains no
private information.

Please let me know of any bugs. Other improvements are welcome.

TODO:
1. Distro detection with lsb_release if available.
2. Ability to dump more info about Wine configurion within the
WINEPREFIX, e.g. Windows version, etc.
3. <Your suggestion here>

Gert

Example log:
----------------------------------------------------------
Wine version: wine-1.1.24-141-g4156b6a
WINEPREFIX: '/home/mohag/.wine'
WINEPREFIX state: 'Clean'
Working directory: '/home/mohag/Downloads'
Date: Wed Jun 24 21:28:05 SAST 2009
OS info (uname -a): 'Linux mohagpc 2.6.28-13-generic #44-Ubuntu SMP
Tue Jun 2 07:55:09 UTC 2009 x86_64 GNU/Linux'
Command: '/home/mohag/wine-git/wine winecfg'
----------------------------------------------------------
wine: created the configuration directory '/home/mohag/.wine'
fixme:mixer:ALSA_MixerInit No master control found on USB Device
0x46d:0x89d, disabling mixer
fixme:system:SetProcessDPIAware stub!
fixme:dwmapi:DwmIsCompositionEnabled 0x33cf94
fixme:file:MoveFileWithProgressW MOVEFILE_WRITE_THROUGH unimplemented
fixme:advapi:SetNamedSecurityInfoW
L"C:\\windows\\gecko\\0.9.1\\wine_gecko\\components\\xpti.dat" 1
536870916 (nil) (nil) 0x33c960 (nil)
fixme:iphlpapi:NotifyAddrChange (Handle 0x60ae908, overlapped 0x60ae910): stub
fixme:file:MoveFileWithProgressW MOVEFILE_WRITE_THROUGH unimplemented
fixme:advapi:SetNamedSecurityInfoW
L"C:\\windows\\gecko\\0.9.1\\wine_gecko\\components\\compreg.dat" 1
536870916 (nil) (nil) 0x33ca50 (nil)
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\xpcom.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\softokn3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\nssutil3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\nss3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\plugins\npnul32.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\xul.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\nspr4.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\sqlite3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\ssl3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\plc4.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\smime3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\nssdbm3.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\js3250.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\nssckbi.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\plds4.dll")
- Symbol NSGetModule not found
0[19eba8]: nsNativeModuleLoader::LoadModule("C:\windows\gecko\0.9.1\wine_gecko\freebl3.dll")
- Symbol NSGetModule not found
fixme:shell:DllCanUnloadNow stub
wine: configuration in '/home/mohag/.wine' has been updated.
fixme:mixer:ALSA_MixerInit No master control found on USB Device
0x46d:0x89d, disabling mixer
----------------------------------------------------------

Script code: (if wget is impracticable for some reason)
#!/bin/sh
# wine_with_log: Script for running wine while showing and logging output
# Gert van den Berg, 24 June 2009
# This script is released into the public domain
#
# The script prefers a wine-git in the home directory, followed by a
wine in /usr/local
# and /usr, with the system's default wine version being tried last

logpath="$HOME/wine-logs"

if [ -x "$HOME/wine-git/wine" ]; then
	wine="$HOME/wine-git/wine"
elif [ -x /usr/local/bin/wine ]; then
	wine="/usr/local/bin/wine"
elif [ -x /usr/bin/wine ]; then
	wine="/usr/bin/wine"
else
	wine=wine
fi

WINEPREFIX="${WINEPREFIX:-$HOME/.wine}" export state not changed
date=`date +%Y%m%d-%H:%M:%S`

if [ -d "$WINEPREFIX" ]; then
	wineprefixstatus="Not clean"
else
	wineprefixstatus="Clean"
fi

if ! winever=`$wine --version` 2> /dev/null; then
	echo "Fatal error: Cannot run wine with command '$wine'!" 1>&2
	exit 1
fi

mkdir "$logpath"

logname="$logpath/$1.$date.$winever.log"

echo "----------------------------------------------------------"|tee "$logname"
echo "Wine version: $winever" |tee -a "$logname"
echo "WINEPREFIX: '$WINEPREFIX'"|tee -a "$logname"
echo "WINEPREFIX state: '$wineprefixstatus'"|tee -a "$logname"
echo "Working directory: '`pwd`'"|tee -a "$logname"
echo "Date: `date`"|tee -a "$logname"
echo "OS info (uname -a): '`uname -a`'"|tee -a "$logname"
echo "Command: '$wine $@'"|tee -a "$logname"
echo "----------------------------------------------------------"|tee
-a "$logname"
wine "$@" 2>&1|tee -a "$logname"
echo "----------------------------------------------------------"|tee
-a "$logname"



More information about the wine-users mailing list